1 /* 2 D bindings for CUDA. 3 Authors: Prasun Anand 4 Copyright: Copyright (c) 2017, Prasun Anand. All rights reserved. 5 License: BSD 3-Clause License 6 */ 7 module cuda_d.cuda; 8 9 import core.stdc.config; 10 11 extern (C): 12 13 /*DEVICE_BUILTIN*/ 14 15 alias void cudaArray; 16 alias void* cudaIpcEventHandle_t; 17 alias void* cudaIpcMemHandle_t; 18 alias CUevent_st * cudaEvent_t; 19 alias enum cudaError cudaError_t; 20 alias enum cudaOutputMode cudaOutputMode_t; 21 22 alias cudaArray * cudaArray_const_t; 23 alias cudaArray * cudaArray_t; 24 //alias CUeglStreamConnection_st * cudaEglStreamConnection; 25 //alias enumcudaError cudaError_t; 26 //alias CUevent_st * cudaEvent_t; 27 //alias cudaGraphicsResource * cudaGraphicsResource_t; 28 //alias cudaMipmappedArray * cudaMipmappedArray_const_t; 29 //alias cudaMipmappedArray * cudaMipmappedArray_t; 30 //alias enumcudaOutputMode cudaOutputMode_t; 31 //alias CUstream_st * cudaStream_t; 32 //alias ulong cudaSurfaceObject_t; 33 //alias ulong cudaTextureObject_t; 34 //alias CUuuid_st cudaUUID_t; 35 36 struct cudaDeviceProp{ 37 int ECCEnabled; 38 int asyncEngineCount; 39 int canMapHostMemory; 40 int clockRate; 41 int computeMode; 42 int concurrentKernels; 43 int concurrentManagedAccess; 44 int deviceOverlap; 45 int globalL1CacheSupported; 46 int hostNativeAtomicSupported; 47 int integrated; 48 int isMultiGpuBoard; 49 int kernelExecTimeoutEnabled; 50 int l2CacheSize; 51 int localL1CacheSupported; 52 int major; 53 int managedMemory; 54 int[3] maxGridSize; 55 int maxSurface1D; 56 int[2] maxSurface1DLayered; 57 int[2] maxSurface2D; 58 int[3] maxSurface2DLayered; 59 int[3] maxSurface3D; 60 int maxSurfaceCubemap; 61 int[2] maxSurfaceCubemapLayered; 62 int maxTexture1D; 63 int[2] maxTexture1DLayered; 64 int maxTexture1DLinear; 65 int maxTexture1DMipmap; 66 int[2] maxTexture2D; 67 int[2] maxTexture2DGather; 68 int[3] maxTexture2DLayered; 69 int[3] maxTexture2DLinear; 70 int[2] maxTexture2DMipmap; 71 int[3] maxTexture3D; 72 int[3] maxTexture3DAlt; 73 int maxTextureCubemap; 74 int[2] maxTextureCubemapLayered; 75 int[3] maxThreadsDim; 76 int maxThreadsPerBlock; 77 int maxThreadsPerMultiProcessor; 78 size_t memPitch; 79 int memoryBusWidth; 80 int memoryClockRate; 81 int minor; 82 int multiGpuBoardGroupID; 83 int multiProcessorCount; 84 char[256] name; 85 int pageableMemoryAccess; 86 int pciBusID; 87 int pciDeviceID; 88 int pciDomainID; 89 int regsPerBlock; 90 int regsPerMultiprocessor; 91 size_t sharedMemPerBlock; 92 size_t sharedMemPerMultiprocessor; 93 int singleToDoublePrecisionPerfRatio; 94 int streamPrioritiesSupported; 95 size_t surfaceAlignment; 96 int tccDriver; 97 size_t textureAlignment; 98 size_t texturePitchAlignment; 99 size_t totalConstMem; 100 size_t totalGlobalMem; 101 int unifiedAddressing; 102 int warpSize; 103 } 104 105 enum cudaChannelFormatKind { 106 cudaChannelFormatKindSigned = 0, 107 cudaChannelFormatKindUnsigned = 1, 108 cudaChannelFormatKindFloat = 2, 109 cudaChannelFormatKindNone = 3 110 } 111 enum cudaComputeMode { 112 cudaComputeModeDefault = 0, 113 cudaComputeModeExclusive = 1, 114 cudaComputeModeProhibited = 2, 115 cudaComputeModeExclusiveProcess = 3 116 } 117 enum cudaError { 118 cudaSuccess = 0, 119 cudaErrorMissingConfiguration = 1, 120 cudaErrorMemoryAllocation = 2, 121 cudaErrorInitializationError = 3, 122 cudaErrorLaunchFailure = 4, 123 cudaErrorPriorLaunchFailure = 5, 124 cudaErrorLaunchTimeout = 6, 125 cudaErrorLaunchOutOfResources = 7, 126 cudaErrorInvalidDeviceFunction = 8, 127 cudaErrorInvalidConfiguration = 9, 128 cudaErrorInvalidDevice = 10, 129 cudaErrorInvalidValue = 11, 130 cudaErrorInvalidPitchValue = 12, 131 cudaErrorInvalidSymbol = 13, 132 cudaErrorMapBufferObjectFailed = 14, 133 cudaErrorUnmapBufferObjectFailed = 15, 134 cudaErrorInvalidHostPointer = 16, 135 cudaErrorInvalidDevicePointer = 17, 136 cudaErrorInvalidTexture = 18, 137 cudaErrorInvalidTextureBinding = 19, 138 cudaErrorInvalidChannelDescriptor = 20, 139 cudaErrorInvalidMemcpyDirection = 21, 140 cudaErrorAddressOfConstant = 22, 141 cudaErrorTextureFetchFailed = 23, 142 cudaErrorTextureNotBound = 24, 143 cudaErrorSynchronizationError = 25, 144 cudaErrorInvalidFilterSetting = 26, 145 cudaErrorInvalidNormSetting = 27, 146 cudaErrorMixedDeviceExecution = 28, 147 cudaErrorCudartUnloading = 29, 148 cudaErrorUnknown = 30, 149 cudaErrorNotYetImplemented = 31, 150 cudaErrorMemoryValueTooLarge = 32, 151 cudaErrorInvalidResourceHandle = 33, 152 cudaErrorNotReady = 34, 153 cudaErrorInsufficientDriver = 35, 154 cudaErrorSetOnActiveProcess = 36, 155 cudaErrorInvalidSurface = 37, 156 cudaErrorNoDevice = 38, 157 cudaErrorECCUncorrectable = 39, 158 cudaErrorSharedObjectSymbolNotFound = 40, 159 cudaErrorSharedObjectInitFailed = 41, 160 cudaErrorUnsupportedLimit = 42, 161 cudaErrorDuplicateVariableName = 43, 162 cudaErrorDuplicateTextureName = 44, 163 cudaErrorDuplicateSurfaceName = 45, 164 cudaErrorDevicesUnavailable = 46, 165 cudaErrorInvalidKernelImage = 47, 166 cudaErrorNoKernelImageForDevice = 48, 167 cudaErrorIncompatibleDriverContext = 49, 168 cudaErrorPeerAccessAlreadyEnabled = 50, 169 cudaErrorPeerAccessNotEnabled = 51, 170 cudaErrorDeviceAlreadyInUse = 54, 171 cudaErrorProfilerDisabled = 55, 172 cudaErrorProfilerNotInitialized = 56, 173 cudaErrorProfilerAlreadyStarted = 57, 174 cudaErrorProfilerAlreadyStopped = 58, 175 cudaErrorStartupFailure = 0x7f, 176 cudaErrorApiFailureBase = 10000 177 } 178 enum cudaFuncCache { 179 cudaFuncCachePreferNone = 0, 180 cudaFuncCachePreferShared = 1, 181 cudaFuncCachePreferL1 = 2 182 } 183 enum cudaGraphicsCubeFace { 184 cudaGraphicsCubeFacePositiveX = 0x00, 185 cudaGraphicsCubeFaceNegativeX = 0x01, 186 cudaGraphicsCubeFacePositiveY = 0x02, 187 cudaGraphicsCubeFaceNegativeY = 0x03, 188 cudaGraphicsCubeFacePositiveZ = 0x04, 189 cudaGraphicsCubeFaceNegativeZ = 0x05 190 } 191 enum cudaGraphicsMapFlags { 192 cudaGraphicsMapFlagsNone = 0, 193 cudaGraphicsMapFlagsReadOnly = 1, 194 cudaGraphicsMapFlagsWriteDiscard = 2 195 } 196 enum cudaGraphicsRegisterFlags { 197 cudaGraphicsRegisterFlagsNone = 0, 198 cudaGraphicsRegisterFlagsReadOnly = 1, 199 cudaGraphicsRegisterFlagsWriteDiscard = 2, 200 cudaGraphicsRegisterFlagsSurfaceLoadStore = 4 201 } 202 enum cudaLimit { 203 cudaLimitStackSize = 0x00, 204 cudaLimitPrintfFifoSize = 0x01, 205 cudaLimitMallocHeapSize = 0x02 206 } 207 enum cudaMemcpyKind { 208 cudaMemcpyHostToHost = 0, 209 cudaMemcpyHostToDevice = 1, 210 cudaMemcpyDeviceToHost = 2, 211 cudaMemcpyDeviceToDevice = 3, 212 cudaMemcpyDefault = 4 213 } 214 enum cudaMemoryType { 215 cudaMemoryTypeHost = 1, 216 cudaMemoryTypeDevice = 2 217 } 218 219 enum cudaSharedMemConfig { 220 cudaSharedMemBankSizeDefault = 0, 221 cudaSharedMemBankSizeFourByte = 1, 222 cudaSharedMemBankSizeEightByte = 2 223 } 224 225 enum cudaOutputMode{ 226 cudaKeyValuePair = 0x00, 227 cudaCSV = 0x01, 228 } 229 230 /** 231 * CUDA API versioning support 232 */ 233 234 enum __CUDA_API_VERSION = 7050; 235 /* CUDA_FORCE_API_VERSION */ 236 237 extern (D) auto __CUDA_API_PTDS(T)(auto ref T api) 238 { 239 return api; 240 } 241 242 extern (D) auto __CUDA_API_PTSZ(T)(auto ref T api) 243 { 244 return api; 245 } 246 247 alias cuDeviceTotalMem = cuDeviceTotalMem_v2; 248 alias cuCtxCreate = cuCtxCreate_v2; 249 alias cuModuleGetGlobal = cuModuleGetGlobal_v2; 250 alias cuMemGetInfo = cuMemGetInfo_v2; 251 alias cuMemAlloc = cuMemAlloc_v2; 252 alias cuMemAllocPitch = cuMemAllocPitch_v2; 253 alias cuMemFree = cuMemFree_v2; 254 alias cuMemGetAddressRange = cuMemGetAddressRange_v2; 255 alias cuMemAllocHost = cuMemAllocHost_v2; 256 alias cuMemHostGetDevicePointer = cuMemHostGetDevicePointer_v2; 257 alias cuMemcpyHtoD = cuMemcpyHtoD_v2; 258 alias cuMemcpyDtoH = cuMemcpyDtoH_v2; 259 alias cuMemcpyDtoD = cuMemcpyDtoD_v2; 260 alias cuMemcpyDtoA = cuMemcpyDtoA_v2; 261 alias cuMemcpyAtoD = cuMemcpyAtoD_v2; 262 alias cuMemcpyHtoA = cuMemcpyHtoA_v2; 263 alias cuMemcpyAtoH = cuMemcpyAtoH_v2; 264 alias cuMemcpyAtoA = cuMemcpyAtoA_v2; 265 alias cuMemcpyHtoAAsync = cuMemcpyHtoAAsync_v2; 266 alias cuMemcpyAtoHAsync = cuMemcpyAtoHAsync_v2; 267 alias cuMemcpy2D = cuMemcpy2D_v2; 268 alias cuMemcpy2DUnaligned = cuMemcpy2DUnaligned_v2; 269 alias cuMemcpy3D = cuMemcpy3D_v2; 270 alias cuMemcpyHtoDAsync = cuMemcpyHtoDAsync_v2; 271 alias cuMemcpyDtoHAsync = cuMemcpyDtoHAsync_v2; 272 alias cuMemcpyDtoDAsync = cuMemcpyDtoDAsync_v2; 273 alias cuMemcpy2DAsync = cuMemcpy2DAsync_v2; 274 alias cuMemcpy3DAsync = cuMemcpy3DAsync_v2; 275 alias cuMemsetD8 = cuMemsetD8_v2; 276 alias cuMemsetD16 = cuMemsetD16_v2; 277 alias cuMemsetD32 = cuMemsetD32_v2; 278 alias cuMemsetD2D8 = cuMemsetD2D8_v2; 279 alias cuMemsetD2D16 = cuMemsetD2D16_v2; 280 alias cuMemsetD2D32 = cuMemsetD2D32_v2; 281 alias cuArrayCreate = cuArrayCreate_v2; 282 alias cuArrayGetDescriptor = cuArrayGetDescriptor_v2; 283 alias cuArray3DCreate = cuArray3DCreate_v2; 284 alias cuArray3DGetDescriptor = cuArray3DGetDescriptor_v2; 285 alias cuTexRefSetAddress = cuTexRefSetAddress_v2; 286 alias cuTexRefGetAddress = cuTexRefGetAddress_v2; 287 alias cuGraphicsResourceGetMappedPointer = cuGraphicsResourceGetMappedPointer_v2; 288 /* __CUDA_API_VERSION_INTERNAL || __CUDA_API_VERSION >= 3020 */ 289 alias cuCtxDestroy = cuCtxDestroy_v2; 290 alias cuCtxPopCurrent = cuCtxPopCurrent_v2; 291 alias cuCtxPushCurrent = cuCtxPushCurrent_v2; 292 alias cuStreamDestroy = cuStreamDestroy_v2; 293 alias cuEventDestroy = cuEventDestroy_v2; 294 /* __CUDA_API_VERSION_INTERNAL || __CUDA_API_VERSION >= 4000 */ 295 alias cuTexRefSetAddress2D = cuTexRefSetAddress2D_v3; 296 /* __CUDA_API_VERSION_INTERNAL || __CUDA_API_VERSION >= 4010 */ 297 alias cuLinkCreate = cuLinkCreate_v2; 298 alias cuLinkAddData = cuLinkAddData_v2; 299 alias cuLinkAddFile = cuLinkAddFile_v2; 300 /* __CUDA_API_VERSION_INTERNAL || __CUDA_API_VERSION >= 6050 */ 301 alias cuMemHostRegister = cuMemHostRegister_v2; 302 alias cuGraphicsResourceSetMapFlags = cuGraphicsResourceSetMapFlags_v2; 303 304 enum CUDA_VERSION = 7050; 305 306 /** 307 * CUDA device pointer 308 * CUdeviceptr is defined as an unsigned integer type whose size matches the size of a pointer on the target platform. 309 */ 310 311 alias CUdeviceptr = ulong; 312 313 /* __CUDA_API_VERSION >= 3020 */ 314 315 alias CUdevice = int; /**< CUDA device */ 316 struct CUctx_st; 317 alias CUcontext = CUctx_st*; /**< CUDA context */ 318 struct CUmod_st; 319 alias CUmodule = CUmod_st*; /**< CUDA module */ 320 struct CUfunc_st; 321 alias CUfunction = CUfunc_st*; /**< CUDA function */ 322 struct CUarray_st; 323 alias CUarray = CUarray_st*; /**< CUDA array */ 324 struct CUmipmappedArray_st; 325 alias CUmipmappedArray = CUmipmappedArray_st*; /**< CUDA mipmapped array */ 326 struct CUtexref_st; 327 alias CUtexref = CUtexref_st*; /**< CUDA texture reference */ 328 struct CUsurfref_st; 329 alias CUsurfref = CUsurfref_st*; /**< CUDA surface reference */ 330 struct CUevent_st; 331 alias CUevent = CUevent_st*; /**< CUDA event */ 332 struct CUstream_st; 333 alias CUstream = CUstream_st*; /**< CUDA stream */ 334 struct CUgraphicsResource_st; 335 alias CUgraphicsResource = CUgraphicsResource_st*; /**< CUDA graphics interop resource */ 336 alias CUtexObject = ulong; /**< An opaque value that represents a CUDA texture object */ 337 alias CUsurfObject = ulong; /**< An opaque value that represents a CUDA surface object */ 338 339 struct CUuuid_st 340 { 341 /**< CUDA definition of UUID */ 342 char[16] bytes; 343 } 344 345 alias CUuuid = CUuuid_st; 346 347 /** 348 * CUDA IPC handle size 349 */ 350 enum CU_IPC_HANDLE_SIZE = 64; 351 352 /** 353 * CUDA IPC event handle 354 */ 355 struct CUipcEventHandle_st 356 { 357 char[CU_IPC_HANDLE_SIZE] reserved; 358 } 359 360 alias CUipcEventHandle = CUipcEventHandle_st; 361 362 /** 363 * CUDA IPC mem handle 364 */ 365 struct CUipcMemHandle_st 366 { 367 char[CU_IPC_HANDLE_SIZE] reserved; 368 } 369 370 alias CUipcMemHandle = CUipcMemHandle_st; 371 372 /** 373 * CUDA Ipc Mem Flags 374 */ 375 enum CUipcMem_flags_enum 376 { 377 CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS = 1 /**< Automatically enable peer access between remote devices as needed */ 378 } 379 380 alias CUipcMem_flags = CUipcMem_flags_enum; 381 382 /** 383 * CUDA Mem Attach Flags 384 */ 385 enum CUmemAttach_flags_enum 386 { 387 CU_MEM_ATTACH_GLOBAL = 1, /**< Memory can be accessed by any stream on any device */ 388 CU_MEM_ATTACH_HOST = 2, /**< Memory cannot be accessed by any stream on any device */ 389 CU_MEM_ATTACH_SINGLE = 4 /**< Memory can only be accessed by a single stream on the associated device */ 390 } 391 392 alias CUmemAttach_flags = CUmemAttach_flags_enum; 393 394 /** 395 * Context creation flags 396 */ 397 enum CUctx_flags_enum 398 { 399 CU_CTX_SCHED_AUTO = 0, /**< Automatic scheduling */ 400 CU_CTX_SCHED_SPIN = 1, /**< Set spin as default scheduling */ 401 CU_CTX_SCHED_YIELD = 2, /**< Set yield as default scheduling */ 402 CU_CTX_SCHED_BLOCKING_SYNC = 4, /**< Set blocking synchronization as default scheduling */ 403 CU_CTX_BLOCKING_SYNC = 4, /**< Set blocking synchronization as default scheduling 404 * \deprecated This flag was deprecated as of CUDA 4.0 405 * and was replaced with ::CU_CTX_SCHED_BLOCKING_SYNC. */ 406 CU_CTX_SCHED_MASK = 7, 407 CU_CTX_MAP_HOST = 8, /**< Support mapped pinned allocations */ 408 CU_CTX_LMEM_RESIZE_TO_MAX = 16, /**< Keep local memory allocation after launch */ 409 CU_CTX_FLAGS_MASK = 31 410 } 411 412 alias CUctx_flags = CUctx_flags_enum; 413 414 /** 415 * Stream creation flags 416 */ 417 enum CUstream_flags_enum 418 { 419 CU_STREAM_DEFAULT = 0, /**< Default stream flag */ 420 CU_STREAM_NON_BLOCKING = 1 /**< Stream does not synchronize with stream 0 (the NULL stream) */ 421 } 422 423 alias CUstream_flags = CUstream_flags_enum; 424 425 /** 426 * Legacy stream handle 427 * 428 * Stream handle that can be passed as a CUstream to use an implicit stream 429 * with legacy synchronization behavior. 430 * 431 * See details of the \link_sync_behavior 432 */ 433 enum CU_STREAM_LEGACY = cast(CUstream) 0x1; 434 435 /** 436 * Per-thread stream handle 437 * 438 * Stream handle that can be passed as a CUstream to use an implicit stream 439 * with per-thread synchronization behavior. 440 * 441 * See details of the \link_sync_behavior 442 */ 443 enum CU_STREAM_PER_THREAD = cast(CUstream) 0x2; 444 445 /** 446 * Event creation flags 447 */ 448 enum CUevent_flags_enum 449 { 450 CU_EVENT_DEFAULT = 0, /**< Default event flag */ 451 CU_EVENT_BLOCKING_SYNC = 1, /**< Event uses blocking synchronization */ 452 CU_EVENT_DISABLE_TIMING = 2, /**< Event will not record timing data */ 453 CU_EVENT_INTERPROCESS = 4 /**< Event is suitable for interprocess use. CU_EVENT_DISABLE_TIMING must be set */ 454 } 455 456 alias CUevent_flags = CUevent_flags_enum; 457 458 /** 459 * Occupancy calculator flag 460 */ 461 enum CUoccupancy_flags_enum 462 { 463 CU_OCCUPANCY_DEFAULT = 0, /**< Default behavior */ 464 CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE = 1 /**< Assume global caching is enabled and cannot be automatically turned off */ 465 } 466 467 alias CUoccupancy_flags = CUoccupancy_flags_enum; 468 469 /** 470 * Array formats 471 */ 472 enum CUarray_format_enum 473 { 474 CU_AD_FORMAT_UNSIGNED_INT8 = 1, /**< Unsigned 8-bit integers */ 475 CU_AD_FORMAT_UNSIGNED_INT16 = 2, /**< Unsigned 16-bit integers */ 476 CU_AD_FORMAT_UNSIGNED_INT32 = 3, /**< Unsigned 32-bit integers */ 477 CU_AD_FORMAT_SIGNED_INT8 = 8, /**< Signed 8-bit integers */ 478 CU_AD_FORMAT_SIGNED_INT16 = 9, /**< Signed 16-bit integers */ 479 CU_AD_FORMAT_SIGNED_INT32 = 10, /**< Signed 32-bit integers */ 480 CU_AD_FORMAT_HALF = 16, /**< 16-bit floating point */ 481 CU_AD_FORMAT_FLOAT = 32 /**< 32-bit floating point */ 482 } 483 484 alias CUarray_format = CUarray_format_enum; 485 486 /** 487 * Texture reference addressing modes 488 */ 489 enum CUaddress_mode_enum 490 { 491 CU_TR_ADDRESS_MODE_WRAP = 0, /**< Wrapping address mode */ 492 CU_TR_ADDRESS_MODE_CLAMP = 1, /**< Clamp to edge address mode */ 493 CU_TR_ADDRESS_MODE_MIRROR = 2, /**< Mirror address mode */ 494 CU_TR_ADDRESS_MODE_BORDER = 3 /**< Border address mode */ 495 } 496 497 alias CUaddress_mode = CUaddress_mode_enum; 498 499 /** 500 * Texture reference filtering modes 501 */ 502 enum CUfilter_mode_enum 503 { 504 CU_TR_FILTER_MODE_POINT = 0, /**< Point filter mode */ 505 CU_TR_FILTER_MODE_LINEAR = 1 /**< Linear filter mode */ 506 } 507 508 alias CUfilter_mode = CUfilter_mode_enum; 509 510 /** 511 * Device properties 512 */ 513 enum CUdevice_attribute_enum 514 { 515 CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1, /**< Maximum number of threads per block */ 516 CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = 2, /**< Maximum block dimension X */ 517 CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = 3, /**< Maximum block dimension Y */ 518 CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = 4, /**< Maximum block dimension Z */ 519 CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = 5, /**< Maximum grid dimension X */ 520 CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = 6, /**< Maximum grid dimension Y */ 521 CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = 7, /**< Maximum grid dimension Z */ 522 CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = 8, /**< Maximum shared memory available per block in bytes */ 523 CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = 8, /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK */ 524 CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = 9, /**< Memory available on device for __constant__ variables in a CUDA C kernel in bytes */ 525 CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10, /**< Warp size in threads */ 526 CU_DEVICE_ATTRIBUTE_MAX_PITCH = 11, /**< Maximum pitch in bytes allowed by memory copies */ 527 CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12, /**< Maximum number of 32-bit registers available per block */ 528 CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = 12, /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK */ 529 CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13, /**< Typical clock frequency in kilohertz */ 530 CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14, /**< Alignment requirement for textures */ 531 CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = 15, /**< Device can possibly copy memory and execute a kernel concurrently. Deprecated. Use instead CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT. */ 532 CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16, /**< Number of multiprocessors on device */ 533 CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = 17, /**< Specifies whether there is a run time limit on kernels */ 534 CU_DEVICE_ATTRIBUTE_INTEGRATED = 18, /**< Device is integrated with host memory */ 535 CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19, /**< Device can map host memory into CUDA address space */ 536 CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20, /**< Compute mode (See ::CUcomputemode for details) */ 537 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = 21, /**< Maximum 1D texture width */ 538 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = 22, /**< Maximum 2D texture width */ 539 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = 23, /**< Maximum 2D texture height */ 540 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = 24, /**< Maximum 3D texture width */ 541 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = 25, /**< Maximum 3D texture height */ 542 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = 26, /**< Maximum 3D texture depth */ 543 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH = 27, /**< Maximum 2D layered texture width */ 544 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT = 28, /**< Maximum 2D layered texture height */ 545 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS = 29, /**< Maximum layers in a 2D layered texture */ 546 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = 27, /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH */ 547 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = 28, /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT */ 548 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = 29, /**< Deprecated, use CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS */ 549 CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = 30, /**< Alignment requirement for surfaces */ 550 CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31, /**< Device can possibly execute multiple kernels concurrently */ 551 CU_DEVICE_ATTRIBUTE_ECC_ENABLED = 32, /**< Device has ECC support enabled */ 552 CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33, /**< PCI bus ID of the device */ 553 CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34, /**< PCI device ID of the device */ 554 CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35, /**< Device is using TCC driver model */ 555 CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE = 36, /**< Peak memory clock frequency in kilohertz */ 556 CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH = 37, /**< Global memory bus width in bits */ 557 CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE = 38, /**< Size of L2 cache in bytes */ 558 CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR = 39, /**< Maximum resident threads per multiprocessor */ 559 CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT = 40, /**< Number of asynchronous engines */ 560 CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = 41, /**< Device shares a unified address space with the host */ 561 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH = 42, /**< Maximum 1D layered texture width */ 562 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS = 43, /**< Maximum layers in a 1D layered texture */ 563 CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER = 44, /**< Deprecated, do not use. */ 564 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH = 45, /**< Maximum 2D texture width if CUDA_ARRAY3D_TEXTURE_GATHER is set */ 565 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT = 46, /**< Maximum 2D texture height if CUDA_ARRAY3D_TEXTURE_GATHER is set */ 566 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE = 47, /**< Alternate maximum 3D texture width */ 567 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE = 48, /**< Alternate maximum 3D texture height */ 568 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE = 49, /**< Alternate maximum 3D texture depth */ 569 CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = 50, /**< PCI domain ID of the device */ 570 CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT = 51, /**< Pitch alignment requirement for textures */ 571 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH = 52, /**< Maximum cubemap texture width/height */ 572 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH = 53, /**< Maximum cubemap layered texture width/height */ 573 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS = 54, /**< Maximum layers in a cubemap layered texture */ 574 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH = 55, /**< Maximum 1D surface width */ 575 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH = 56, /**< Maximum 2D surface width */ 576 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT = 57, /**< Maximum 2D surface height */ 577 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH = 58, /**< Maximum 3D surface width */ 578 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT = 59, /**< Maximum 3D surface height */ 579 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH = 60, /**< Maximum 3D surface depth */ 580 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH = 61, /**< Maximum 1D layered surface width */ 581 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS = 62, /**< Maximum layers in a 1D layered surface */ 582 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH = 63, /**< Maximum 2D layered surface width */ 583 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT = 64, /**< Maximum 2D layered surface height */ 584 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS = 65, /**< Maximum layers in a 2D layered surface */ 585 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH = 66, /**< Maximum cubemap surface width */ 586 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH = 67, /**< Maximum cubemap layered surface width */ 587 CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS = 68, /**< Maximum layers in a cubemap layered surface */ 588 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH = 69, /**< Maximum 1D linear texture width */ 589 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH = 70, /**< Maximum 2D linear texture width */ 590 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT = 71, /**< Maximum 2D linear texture height */ 591 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH = 72, /**< Maximum 2D linear texture pitch in bytes */ 592 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH = 73, /**< Maximum mipmapped 2D texture width */ 593 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT = 74, /**< Maximum mipmapped 2D texture height */ 594 CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75, /**< Major compute capability version number */ 595 CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76, /**< Minor compute capability version number */ 596 CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH = 77, /**< Maximum mipmapped 1D texture width */ 597 CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED = 78, /**< Device supports stream priorities */ 598 CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED = 79, /**< Device supports caching globals in L1 */ 599 CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED = 80, /**< Device supports caching locals in L1 */ 600 CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR = 81, /**< Maximum shared memory available per multiprocessor in bytes */ 601 CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR = 82, /**< Maximum number of 32-bit registers available per multiprocessor */ 602 CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY = 83, /**< Device can allocate managed memory on this system */ 603 CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD = 84, /**< Device is on a multi-GPU board */ 604 CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID = 85, /**< Unique id for a group of devices on the same multi-GPU board */ 605 CU_DEVICE_ATTRIBUTE_MAX = 86 606 } 607 608 alias CUdevice_attribute = CUdevice_attribute_enum; 609 610 /** 611 * Legacy device properties 612 */ 613 struct CUdevprop_st 614 { 615 int maxThreadsPerBlock; /**< Maximum number of threads per block */ 616 int[3] maxThreadsDim; /**< Maximum size of each dimension of a block */ 617 int[3] maxGridSize; /**< Maximum size of each dimension of a grid */ 618 int sharedMemPerBlock; /**< Shared memory available per block in bytes */ 619 int totalConstantMemory; /**< Constant memory available on device in bytes */ 620 int SIMDWidth; /**< Warp size in threads */ 621 int memPitch; /**< Maximum pitch in bytes allowed by memory copies */ 622 int regsPerBlock; /**< 32-bit registers available per block */ 623 int clockRate; /**< Clock frequency in kilohertz */ 624 int textureAlign; /**< Alignment requirement for textures */ 625 } 626 627 alias CUdevprop = CUdevprop_st; 628 629 /** 630 * Pointer information 631 */ 632 enum CUpointer_attribute_enum 633 { 634 CU_POINTER_ATTRIBUTE_CONTEXT = 1, /**< The ::CUcontext on which a pointer was allocated or registered */ 635 CU_POINTER_ATTRIBUTE_MEMORY_TYPE = 2, /**< The ::CUmemorytype describing the physical location of a pointer */ 636 CU_POINTER_ATTRIBUTE_DEVICE_POINTER = 3, /**< The address at which a pointer's memory may be accessed on the device */ 637 CU_POINTER_ATTRIBUTE_HOST_POINTER = 4, /**< The address at which a pointer's memory may be accessed on the host */ 638 CU_POINTER_ATTRIBUTE_P2P_TOKENS = 5, /**< A pair of tokens for use with the nv-p2p.h Linux kernel interface */ 639 CU_POINTER_ATTRIBUTE_SYNC_MEMOPS = 6, /**< Synchronize every synchronous memory operation initiated on this region */ 640 CU_POINTER_ATTRIBUTE_BUFFER_ID = 7, /**< A process-wide unique ID for an allocated memory region*/ 641 CU_POINTER_ATTRIBUTE_IS_MANAGED = 8 /**< Indicates if the pointer points to managed memory */ 642 } 643 644 alias CUpointer_attribute = CUpointer_attribute_enum; 645 646 /** 647 * Function properties 648 */ 649 enum CUfunction_attribute_enum 650 { 651 /** 652 * The maximum number of threads per block, beyond which a launch of the 653 * function would fail. This number depends on both the function and the 654 * device on which the function is currently loaded. 655 */ 656 CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0, 657 658 /** 659 * The size in bytes of statically-allocated shared memory required by 660 * this function. This does not include dynamically-allocated shared 661 * memory requested by the user at runtime. 662 */ 663 CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1, 664 665 /** 666 * The size in bytes of user-allocated constant memory required by this 667 * function. 668 */ 669 CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2, 670 671 /** 672 * The size in bytes of local memory used by each thread of this function. 673 */ 674 CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3, 675 676 /** 677 * The number of registers used by each thread of this function. 678 */ 679 CU_FUNC_ATTRIBUTE_NUM_REGS = 4, 680 681 /** 682 * The PTX virtual architecture version for which the function was 683 * compiled. This value is the major PTX version * 10 + the minor PTX 684 * version, so a PTX version 1.3 function would return the value 13. 685 * Note that this may return the undefined value of 0 for cubins 686 * compiled prior to CUDA 3.0. 687 */ 688 CU_FUNC_ATTRIBUTE_PTX_VERSION = 5, 689 690 /** 691 * The binary architecture version for which the function was compiled. 692 * This value is the major binary version * 10 + the minor binary version, 693 * so a binary version 1.3 function would return the value 13. Note that 694 * this will return a value of 10 for legacy cubins that do not have a 695 * properly-encoded binary architecture version. 696 */ 697 CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6, 698 699 /** 700 * The attribute to indicate whether the function has been compiled with 701 * user specified option "-Xptxas --dlcm=ca" set . 702 */ 703 CU_FUNC_ATTRIBUTE_CACHE_MODE_CA = 7, 704 705 CU_FUNC_ATTRIBUTE_MAX = 8 706 } 707 708 alias CUfunction_attribute = CUfunction_attribute_enum; 709 710 /** 711 * Function cache configurations 712 */ 713 enum CUfunc_cache_enum 714 { 715 CU_FUNC_CACHE_PREFER_NONE = 0, /**< no preference for shared memory or L1 (default) */ 716 CU_FUNC_CACHE_PREFER_SHARED = 1, /**< prefer larger shared memory and smaller L1 cache */ 717 CU_FUNC_CACHE_PREFER_L1 = 2, /**< prefer larger L1 cache and smaller shared memory */ 718 CU_FUNC_CACHE_PREFER_EQUAL = 3 /**< prefer equal sized L1 cache and shared memory */ 719 } 720 721 alias CUfunc_cache = CUfunc_cache_enum; 722 723 /** 724 * Shared memory configurations 725 */ 726 enum CUsharedconfig_enum 727 { 728 CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE = 0, /**< set default shared memory bank size */ 729 CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE = 1, /**< set shared memory bank width to four bytes */ 730 CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE = 2 /**< set shared memory bank width to eight bytes */ 731 } 732 733 alias CUsharedconfig = CUsharedconfig_enum; 734 735 /** 736 * Memory types 737 */ 738 enum CUmemorytype_enum 739 { 740 CU_MEMORYTYPE_HOST = 1, /**< Host memory */ 741 CU_MEMORYTYPE_DEVICE = 2, /**< Device memory */ 742 CU_MEMORYTYPE_ARRAY = 3, /**< Array memory */ 743 CU_MEMORYTYPE_UNIFIED = 4 /**< Unified device or host memory */ 744 } 745 746 alias CUmemorytype = CUmemorytype_enum; 747 748 /** 749 * Compute Modes 750 */ 751 enum CUcomputemode_enum 752 { 753 CU_COMPUTEMODE_DEFAULT = 0, /**< Default compute mode (Multiple contexts allowed per device) */ 754 CU_COMPUTEMODE_EXCLUSIVE = 1, /**< Compute-exclusive-thread mode (Only one context used by a single thread can be present on this device at a time) */ 755 CU_COMPUTEMODE_PROHIBITED = 2, /**< Compute-prohibited mode (No contexts can be created on this device at this time) */ 756 CU_COMPUTEMODE_EXCLUSIVE_PROCESS = 3 /**< Compute-exclusive-process mode (Only one context used by a single process can be present on this device at a time) */ 757 } 758 759 alias CUcomputemode = CUcomputemode_enum; 760 761 /** 762 * Online compiler and linker options 763 */ 764 enum CUjit_option_enum 765 { 766 /** 767 * Max number of registers that a thread may use.\n 768 * Option type: unsigned int\n 769 * Applies to: compiler only 770 */ 771 CU_JIT_MAX_REGISTERS = 0, 772 773 /** 774 * IN: Specifies minimum number of threads per block to target compilation 775 * for\n 776 * OUT: Returns the number of threads the compiler actually targeted. 777 * This restricts the resource utilization fo the compiler (e.g. max 778 * registers) such that a block with the given number of threads should be 779 * able to launch based on register limitations. Note, this option does not 780 * currently take into account any other resource limitations, such as 781 * shared memory utilization.\n 782 * Cannot be combined with ::CU_JIT_TARGET.\n 783 * Option type: unsigned int\n 784 * Applies to: compiler only 785 */ 786 CU_JIT_THREADS_PER_BLOCK = 1, 787 788 /** 789 * Overwrites the option value with the total wall clock time, in 790 * milliseconds, spent in the compiler and linker\n 791 * Option type: float\n 792 * Applies to: compiler and linker 793 */ 794 CU_JIT_WALL_TIME = 2, 795 796 /** 797 * Pointer to a buffer in which to print any log messages 798 * that are informational in nature (the buffer size is specified via 799 * option ::CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES)\n 800 * Option type: char *\n 801 * Applies to: compiler and linker 802 */ 803 CU_JIT_INFO_LOG_BUFFER = 3, 804 805 /** 806 * IN: Log buffer size in bytes. Log messages will be capped at this size 807 * (including null terminator)\n 808 * OUT: Amount of log buffer filled with messages\n 809 * Option type: unsigned int\n 810 * Applies to: compiler and linker 811 */ 812 CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES = 4, 813 814 /** 815 * Pointer to a buffer in which to print any log messages that 816 * reflect errors (the buffer size is specified via option 817 * ::CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES)\n 818 * Option type: char *\n 819 * Applies to: compiler and linker 820 */ 821 CU_JIT_ERROR_LOG_BUFFER = 5, 822 823 /** 824 * IN: Log buffer size in bytes. Log messages will be capped at this size 825 * (including null terminator)\n 826 * OUT: Amount of log buffer filled with messages\n 827 * Option type: unsigned int\n 828 * Applies to: compiler and linker 829 */ 830 CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES = 6, 831 832 /** 833 * Level of optimizations to apply to generated code (0 - 4), with 4 834 * being the default and highest level of optimizations.\n 835 * Option type: unsigned int\n 836 * Applies to: compiler only 837 */ 838 CU_JIT_OPTIMIZATION_LEVEL = 7, 839 840 /** 841 * No option value required. Determines the target based on the current 842 * attached context (default)\n 843 * Option type: No option value needed\n 844 * Applies to: compiler and linker 845 */ 846 CU_JIT_TARGET_FROM_CUCONTEXT = 8, 847 848 /** 849 * Target is chosen based on supplied ::CUjit_target. Cannot be 850 * combined with ::CU_JIT_THREADS_PER_BLOCK.\n 851 * Option type: unsigned int for enumerated type ::CUjit_target\n 852 * Applies to: compiler and linker 853 */ 854 CU_JIT_TARGET = 9, 855 856 /** 857 * Specifies choice of fallback strategy if matching cubin is not found. 858 * Choice is based on supplied ::CUjit_fallback. This option cannot be 859 * used with cuLink* APIs as the linker requires exact matches.\n 860 * Option type: unsigned int for enumerated type ::CUjit_fallback\n 861 * Applies to: compiler only 862 */ 863 CU_JIT_FALLBACK_STRATEGY = 10, 864 865 /** 866 * Specifies whether to create debug information in output (-g) 867 * (0: false, default)\n 868 * Option type: int\n 869 * Applies to: compiler and linker 870 */ 871 CU_JIT_GENERATE_DEBUG_INFO = 11, 872 873 /** 874 * Generate verbose log messages (0: false, default)\n 875 * Option type: int\n 876 * Applies to: compiler and linker 877 */ 878 CU_JIT_LOG_VERBOSE = 12, 879 880 /** 881 * Generate line number information (-lineinfo) (0: false, default)\n 882 * Option type: int\n 883 * Applies to: compiler only 884 */ 885 CU_JIT_GENERATE_LINE_INFO = 13, 886 887 /** 888 * Specifies whether to enable caching explicitly (-dlcm) \n 889 * Choice is based on supplied ::CUjit_cacheMode_enum.\n 890 * Option type: unsigned int for enumerated type ::CUjit_cacheMode_enum\n 891 * Applies to: compiler only 892 */ 893 CU_JIT_CACHE_MODE = 14, 894 895 CU_JIT_NUM_OPTIONS = 15 896 } 897 898 alias CUjit_option = CUjit_option_enum; 899 900 /** 901 * Online compilation targets 902 */ 903 enum CUjit_target_enum 904 { 905 CU_TARGET_COMPUTE_10 = 10, /**< Compute device class 1.0 */ 906 CU_TARGET_COMPUTE_11 = 11, /**< Compute device class 1.1 */ 907 CU_TARGET_COMPUTE_12 = 12, /**< Compute device class 1.2 */ 908 CU_TARGET_COMPUTE_13 = 13, /**< Compute device class 1.3 */ 909 CU_TARGET_COMPUTE_20 = 20, /**< Compute device class 2.0 */ 910 CU_TARGET_COMPUTE_21 = 21, /**< Compute device class 2.1 */ 911 CU_TARGET_COMPUTE_30 = 30, /**< Compute device class 3.0 */ 912 CU_TARGET_COMPUTE_32 = 32, /**< Compute device class 3.2 */ 913 CU_TARGET_COMPUTE_35 = 35, /**< Compute device class 3.5 */ 914 CU_TARGET_COMPUTE_37 = 37, /**< Compute device class 3.7 */ 915 CU_TARGET_COMPUTE_50 = 50, /**< Compute device class 5.0 */ 916 CU_TARGET_COMPUTE_52 = 52 /**< Compute device class 5.2 */ 917 } 918 919 alias CUjit_target = CUjit_target_enum; 920 921 /** 922 * Cubin matching fallback strategies 923 */ 924 enum CUjit_fallback_enum 925 { 926 CU_PREFER_PTX = 0, /**< Prefer to compile ptx if exact binary match not found */ 927 928 CU_PREFER_BINARY = 1 /**< Prefer to fall back to compatible binary code if exact match not found */ 929 } 930 931 alias CUjit_fallback = CUjit_fallback_enum; 932 933 /** 934 * Caching modes for dlcm 935 */ 936 enum CUjit_cacheMode_enum 937 { 938 CU_JIT_CACHE_OPTION_NONE = 0, /**< Compile with no -dlcm flag specified */ 939 CU_JIT_CACHE_OPTION_CG = 1, /**< Compile with L1 cache disabled */ 940 CU_JIT_CACHE_OPTION_CA = 2 /**< Compile with L1 cache enabled */ 941 } 942 943 alias CUjit_cacheMode = CUjit_cacheMode_enum; 944 945 /** 946 * Device code formats 947 */ 948 enum CUjitInputType_enum 949 { 950 /** 951 * Compiled device-class-specific device code\n 952 * Applicable options: none 953 */ 954 CU_JIT_INPUT_CUBIN = 0, 955 956 /** 957 * PTX source code\n 958 * Applicable options: PTX compiler options 959 */ 960 CU_JIT_INPUT_PTX = 1, 961 962 /** 963 * Bundle of multiple cubins and/or PTX of some device code\n 964 * Applicable options: PTX compiler options, ::CU_JIT_FALLBACK_STRATEGY 965 */ 966 CU_JIT_INPUT_FATBINARY = 2, 967 968 /** 969 * Host object with embedded device code\n 970 * Applicable options: PTX compiler options, ::CU_JIT_FALLBACK_STRATEGY 971 */ 972 CU_JIT_INPUT_OBJECT = 3, 973 974 /** 975 * Archive of host objects with embedded device code\n 976 * Applicable options: PTX compiler options, ::CU_JIT_FALLBACK_STRATEGY 977 */ 978 CU_JIT_INPUT_LIBRARY = 4, 979 980 CU_JIT_NUM_INPUT_TYPES = 5 981 } 982 983 alias CUjitInputType = CUjitInputType_enum; 984 985 struct CUlinkState_st; 986 alias CUlinkState = CUlinkState_st*; 987 /* __CUDA_API_VERSION >= 5050 */ 988 989 /** 990 * Flags to register a graphics resource 991 */ 992 enum CUgraphicsRegisterFlags_enum 993 { 994 CU_GRAPHICS_REGISTER_FLAGS_NONE = 0, 995 CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY = 1, 996 CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD = 2, 997 CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST = 4, 998 CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER = 8 999 } 1000 1001 alias CUgraphicsRegisterFlags = CUgraphicsRegisterFlags_enum; 1002 1003 /** 1004 * Flags for mapping and unmapping interop resources 1005 */ 1006 enum CUgraphicsMapResourceFlags_enum 1007 { 1008 CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = 0, 1009 CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = 1, 1010 CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 2 1011 } 1012 1013 alias CUgraphicsMapResourceFlags = CUgraphicsMapResourceFlags_enum; 1014 1015 /** 1016 * Array indices for cube faces 1017 */ 1018 enum CUarray_cubemap_face_enum 1019 { 1020 CU_CUBEMAP_FACE_POSITIVE_X = 0, /**< Positive X face of cubemap */ 1021 CU_CUBEMAP_FACE_NEGATIVE_X = 1, /**< Negative X face of cubemap */ 1022 CU_CUBEMAP_FACE_POSITIVE_Y = 2, /**< Positive Y face of cubemap */ 1023 CU_CUBEMAP_FACE_NEGATIVE_Y = 3, /**< Negative Y face of cubemap */ 1024 CU_CUBEMAP_FACE_POSITIVE_Z = 4, /**< Positive Z face of cubemap */ 1025 CU_CUBEMAP_FACE_NEGATIVE_Z = 5 /**< Negative Z face of cubemap */ 1026 } 1027 1028 alias CUarray_cubemap_face = CUarray_cubemap_face_enum; 1029 1030 /** 1031 * Limits 1032 */ 1033 enum CUlimit_enum 1034 { 1035 CU_LIMIT_STACK_SIZE = 0, /**< GPU thread stack size */ 1036 CU_LIMIT_PRINTF_FIFO_SIZE = 1, /**< GPU printf FIFO size */ 1037 CU_LIMIT_MALLOC_HEAP_SIZE = 2, /**< GPU malloc heap size */ 1038 CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH = 3, /**< GPU device runtime launch synchronize depth */ 1039 CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT = 4, /**< GPU device runtime pending launch count */ 1040 CU_LIMIT_MAX = 5 1041 } 1042 1043 alias CUlimit = CUlimit_enum; 1044 1045 /** 1046 * Resource types 1047 */ 1048 enum CUresourcetype_enum 1049 { 1050 CU_RESOURCE_TYPE_ARRAY = 0, /**< Array resoure */ 1051 CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = 1, /**< Mipmapped array resource */ 1052 CU_RESOURCE_TYPE_LINEAR = 2, /**< Linear resource */ 1053 CU_RESOURCE_TYPE_PITCH2D = 3 /**< Pitch 2D resource */ 1054 } 1055 1056 alias CUresourcetype = CUresourcetype_enum; 1057 1058 /** 1059 * Error codes 1060 */ 1061 enum cudaError_enum 1062 { 1063 /** 1064 * The API call returned with no errors. In the case of query calls, this 1065 * can also mean that the operation being queried is complete (see 1066 * ::cuEventQuery() and ::cuStreamQuery()). 1067 */ 1068 CUDA_SUCCESS = 0, 1069 1070 /** 1071 * This indicates that one or more of the parameters passed to the API call 1072 * is not within an acceptable range of values. 1073 */ 1074 CUDA_ERROR_INVALID_VALUE = 1, 1075 1076 /** 1077 * The API call failed because it was unable to allocate enough memory to 1078 * perform the requested operation. 1079 */ 1080 CUDA_ERROR_OUT_OF_MEMORY = 2, 1081 1082 /** 1083 * This indicates that the CUDA driver has not been initialized with 1084 * ::cuInit() or that initialization has failed. 1085 */ 1086 CUDA_ERROR_NOT_INITIALIZED = 3, 1087 1088 /** 1089 * This indicates that the CUDA driver is in the process of shutting down. 1090 */ 1091 CUDA_ERROR_DEINITIALIZED = 4, 1092 1093 /** 1094 * This indicates profiler is not initialized for this run. This can 1095 * happen when the application is running with external profiling tools 1096 * like visual profiler. 1097 */ 1098 CUDA_ERROR_PROFILER_DISABLED = 5, 1099 1100 /** 1101 * \deprecated 1102 * This error return is deprecated as of CUDA 5.0. It is no longer an error 1103 * to attempt to enable/disable the profiling via ::cuProfilerStart or 1104 * ::cuProfilerStop without initialization. 1105 */ 1106 CUDA_ERROR_PROFILER_NOT_INITIALIZED = 6, 1107 1108 /** 1109 * \deprecated 1110 * This error return is deprecated as of CUDA 5.0. It is no longer an error 1111 * to call cuProfilerStart() when profiling is already enabled. 1112 */ 1113 CUDA_ERROR_PROFILER_ALREADY_STARTED = 7, 1114 1115 /** 1116 * \deprecated 1117 * This error return is deprecated as of CUDA 5.0. It is no longer an error 1118 * to call cuProfilerStop() when profiling is already disabled. 1119 */ 1120 CUDA_ERROR_PROFILER_ALREADY_STOPPED = 8, 1121 1122 /** 1123 * This indicates that no CUDA-capable devices were detected by the installed 1124 * CUDA driver. 1125 */ 1126 CUDA_ERROR_NO_DEVICE = 100, 1127 1128 /** 1129 * This indicates that the device ordinal supplied by the user does not 1130 * correspond to a valid CUDA device. 1131 */ 1132 CUDA_ERROR_INVALID_DEVICE = 101, 1133 1134 /** 1135 * This indicates that the device kernel image is invalid. This can also 1136 * indicate an invalid CUDA module. 1137 */ 1138 CUDA_ERROR_INVALID_IMAGE = 200, 1139 1140 /** 1141 * This most frequently indicates that there is no context bound to the 1142 * current thread. This can also be returned if the context passed to an 1143 * API call is not a valid handle (such as a context that has had 1144 * ::cuCtxDestroy() invoked on it). This can also be returned if a user 1145 * mixes different API versions (i.e. 3010 context with 3020 API calls). 1146 * See ::cuCtxGetApiVersion() for more details. 1147 */ 1148 CUDA_ERROR_INVALID_CONTEXT = 201, 1149 1150 /** 1151 * This indicated that the context being supplied as a parameter to the 1152 * API call was already the active context. 1153 * \deprecated 1154 * This error return is deprecated as of CUDA 3.2. It is no longer an 1155 * error to attempt to push the active context via ::cuCtxPushCurrent(). 1156 */ 1157 CUDA_ERROR_CONTEXT_ALREADY_CURRENT = 202, 1158 1159 /** 1160 * This indicates that a map or register operation has failed. 1161 */ 1162 CUDA_ERROR_MAP_FAILED = 205, 1163 1164 /** 1165 * This indicates that an unmap or unregister operation has failed. 1166 */ 1167 CUDA_ERROR_UNMAP_FAILED = 206, 1168 1169 /** 1170 * This indicates that the specified array is currently mapped and thus 1171 * cannot be destroyed. 1172 */ 1173 CUDA_ERROR_ARRAY_IS_MAPPED = 207, 1174 1175 /** 1176 * This indicates that the resource is already mapped. 1177 */ 1178 CUDA_ERROR_ALREADY_MAPPED = 208, 1179 1180 /** 1181 * This indicates that there is no kernel image available that is suitable 1182 * for the device. This can occur when a user specifies code generation 1183 * options for a particular CUDA source file that do not include the 1184 * corresponding device configuration. 1185 */ 1186 CUDA_ERROR_NO_BINARY_FOR_GPU = 209, 1187 1188 /** 1189 * This indicates that a resource has already been acquired. 1190 */ 1191 CUDA_ERROR_ALREADY_ACQUIRED = 210, 1192 1193 /** 1194 * This indicates that a resource is not mapped. 1195 */ 1196 CUDA_ERROR_NOT_MAPPED = 211, 1197 1198 /** 1199 * This indicates that a mapped resource is not available for access as an 1200 * array. 1201 */ 1202 CUDA_ERROR_NOT_MAPPED_AS_ARRAY = 212, 1203 1204 /** 1205 * This indicates that a mapped resource is not available for access as a 1206 * pointer. 1207 */ 1208 CUDA_ERROR_NOT_MAPPED_AS_POINTER = 213, 1209 1210 /** 1211 * This indicates that an uncorrectable ECC error was detected during 1212 * execution. 1213 */ 1214 CUDA_ERROR_ECC_UNCORRECTABLE = 214, 1215 1216 /** 1217 * This indicates that the ::CUlimit passed to the API call is not 1218 * supported by the active device. 1219 */ 1220 CUDA_ERROR_UNSUPPORTED_LIMIT = 215, 1221 1222 /** 1223 * This indicates that the ::CUcontext passed to the API call can 1224 * only be bound to a single CPU thread at a time but is already 1225 * bound to a CPU thread. 1226 */ 1227 CUDA_ERROR_CONTEXT_ALREADY_IN_USE = 216, 1228 1229 /** 1230 * This indicates that peer access is not supported across the given 1231 * devices. 1232 */ 1233 CUDA_ERROR_PEER_ACCESS_UNSUPPORTED = 217, 1234 1235 /** 1236 * This indicates that a PTX JIT compilation failed. 1237 */ 1238 CUDA_ERROR_INVALID_PTX = 218, 1239 1240 /** 1241 * This indicates an error with OpenGL or DirectX context. 1242 */ 1243 CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219, 1244 1245 /** 1246 * This indicates that the device kernel source is invalid. 1247 */ 1248 CUDA_ERROR_INVALID_SOURCE = 300, 1249 1250 /** 1251 * This indicates that the file specified was not found. 1252 */ 1253 CUDA_ERROR_FILE_NOT_FOUND = 301, 1254 1255 /** 1256 * This indicates that a link to a shared object failed to resolve. 1257 */ 1258 CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302, 1259 1260 /** 1261 * This indicates that initialization of a shared object failed. 1262 */ 1263 CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = 303, 1264 1265 /** 1266 * This indicates that an OS call failed. 1267 */ 1268 CUDA_ERROR_OPERATING_SYSTEM = 304, 1269 1270 /** 1271 * This indicates that a resource handle passed to the API call was not 1272 * valid. Resource handles are opaque types like ::CUstream and ::CUevent. 1273 */ 1274 CUDA_ERROR_INVALID_HANDLE = 400, 1275 1276 /** 1277 * This indicates that a named symbol was not found. Examples of symbols 1278 * are global/constant variable names, texture names, and surface names. 1279 */ 1280 CUDA_ERROR_NOT_FOUND = 500, 1281 1282 /** 1283 * This indicates that asynchronous operations issued previously have not 1284 * completed yet. This result is not actually an error, but must be indicated 1285 * differently than ::CUDA_SUCCESS (which indicates completion). Calls that 1286 * may return this value include ::cuEventQuery() and ::cuStreamQuery(). 1287 */ 1288 CUDA_ERROR_NOT_READY = 600, 1289 1290 /** 1291 * While executing a kernel, the device encountered a 1292 * load or store instruction on an invalid memory address. 1293 * The context cannot be used, so it must be destroyed (and a new one should be created). 1294 * All existing device memory allocations from this context are invalid 1295 * and must be reconstructed if the program is to continue using CUDA. 1296 */ 1297 CUDA_ERROR_ILLEGAL_ADDRESS = 700, 1298 1299 /** 1300 * This indicates that a launch did not occur because it did not have 1301 * appropriate resources. This error usually indicates that the user has 1302 * attempted to pass too many arguments to the device kernel, or the 1303 * kernel launch specifies too many threads for the kernel's register 1304 * count. Passing arguments of the wrong size (i.e. a 64-bit pointer 1305 * when a 32-bit int is expected) is equivalent to passing too many 1306 * arguments and can also result in this error. 1307 */ 1308 CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = 701, 1309 1310 /** 1311 * This indicates that the device kernel took too long to execute. This can 1312 * only occur if timeouts are enabled - see the device attribute 1313 * ::CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT for more information. The 1314 * context cannot be used (and must be destroyed similar to 1315 * ::CUDA_ERROR_LAUNCH_FAILED). All existing device memory allocations from 1316 * this context are invalid and must be reconstructed if the program is to 1317 * continue using CUDA. 1318 */ 1319 CUDA_ERROR_LAUNCH_TIMEOUT = 702, 1320 1321 /** 1322 * This error indicates a kernel launch that uses an incompatible texturing 1323 * mode. 1324 */ 1325 CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703, 1326 1327 /** 1328 * This error indicates that a call to ::cuCtxEnablePeerAccess() is 1329 * trying to re-enable peer access to a context which has already 1330 * had peer access to it enabled. 1331 */ 1332 CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED = 704, 1333 1334 /** 1335 * This error indicates that ::cuCtxDisablePeerAccess() is 1336 * trying to disable peer access which has not been enabled yet 1337 * via ::cuCtxEnablePeerAccess(). 1338 */ 1339 CUDA_ERROR_PEER_ACCESS_NOT_ENABLED = 705, 1340 1341 /** 1342 * This error indicates that the primary context for the specified device 1343 * has already been initialized. 1344 */ 1345 CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE = 708, 1346 1347 /** 1348 * This error indicates that the context current to the calling thread 1349 * has been destroyed using ::cuCtxDestroy, or is a primary context which 1350 * has not yet been initialized. 1351 */ 1352 CUDA_ERROR_CONTEXT_IS_DESTROYED = 709, 1353 1354 /** 1355 * A device-side assert triggered during kernel execution. The context 1356 * cannot be used anymore, and must be destroyed. All existing device 1357 * memory allocations from this context are invalid and must be 1358 * reconstructed if the program is to continue using CUDA. 1359 */ 1360 CUDA_ERROR_ASSERT = 710, 1361 1362 /** 1363 * This error indicates that the hardware resources required to enable 1364 * peer access have been exhausted for one or more of the devices 1365 * passed to ::cuCtxEnablePeerAccess(). 1366 */ 1367 CUDA_ERROR_TOO_MANY_PEERS = 711, 1368 1369 /** 1370 * This error indicates that the memory range passed to ::cuMemHostRegister() 1371 * has already been registered. 1372 */ 1373 CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED = 712, 1374 1375 /** 1376 * This error indicates that the pointer passed to ::cuMemHostUnregister() 1377 * does not correspond to any currently registered memory region. 1378 */ 1379 CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED = 713, 1380 1381 /** 1382 * While executing a kernel, the device encountered a stack error. 1383 * This can be due to stack corruption or exceeding the stack size limit. 1384 * The context cannot be used, so it must be destroyed (and a new one should be created). 1385 * All existing device memory allocations from this context are invalid 1386 * and must be reconstructed if the program is to continue using CUDA. 1387 */ 1388 CUDA_ERROR_HARDWARE_STACK_ERROR = 714, 1389 1390 /** 1391 * While executing a kernel, the device encountered an illegal instruction. 1392 * The context cannot be used, so it must be destroyed (and a new one should be created). 1393 * All existing device memory allocations from this context are invalid 1394 * and must be reconstructed if the program is to continue using CUDA. 1395 */ 1396 CUDA_ERROR_ILLEGAL_INSTRUCTION = 715, 1397 1398 /** 1399 * While executing a kernel, the device encountered a load or store instruction 1400 * on a memory address which is not aligned. 1401 * The context cannot be used, so it must be destroyed (and a new one should be created). 1402 * All existing device memory allocations from this context are invalid 1403 * and must be reconstructed if the program is to continue using CUDA. 1404 */ 1405 CUDA_ERROR_MISALIGNED_ADDRESS = 716, 1406 1407 /** 1408 * While executing a kernel, the device encountered an instruction 1409 * which can only operate on memory locations in certain address spaces 1410 * (global, shared, or local), but was supplied a memory address not 1411 * belonging to an allowed address space. 1412 * The context cannot be used, so it must be destroyed (and a new one should be created). 1413 * All existing device memory allocations from this context are invalid 1414 * and must be reconstructed if the program is to continue using CUDA. 1415 */ 1416 CUDA_ERROR_INVALID_ADDRESS_SPACE = 717, 1417 1418 /** 1419 * While executing a kernel, the device program counter wrapped its address space. 1420 * The context cannot be used, so it must be destroyed (and a new one should be created). 1421 * All existing device memory allocations from this context are invalid 1422 * and must be reconstructed if the program is to continue using CUDA. 1423 */ 1424 CUDA_ERROR_INVALID_PC = 718, 1425 1426 /** 1427 * An exception occurred on the device while executing a kernel. Common 1428 * causes include dereferencing an invalid device pointer and accessing 1429 * out of bounds shared memory. The context cannot be used, so it must 1430 * be destroyed (and a new one should be created). All existing device 1431 * memory allocations from this context are invalid and must be 1432 * reconstructed if the program is to continue using CUDA. 1433 */ 1434 CUDA_ERROR_LAUNCH_FAILED = 719, 1435 1436 /** 1437 * This error indicates that the attempted operation is not permitted. 1438 */ 1439 CUDA_ERROR_NOT_PERMITTED = 800, 1440 1441 /** 1442 * This error indicates that the attempted operation is not supported 1443 * on the current system or device. 1444 */ 1445 CUDA_ERROR_NOT_SUPPORTED = 801, 1446 1447 /** 1448 * This indicates that an unknown internal error has occurred. 1449 */ 1450 CUDA_ERROR_UNKNOWN = 999 1451 } 1452 1453 alias CUresult = cudaError_enum; 1454 1455 alias CUstreamCallback = void function (CUstream hStream, CUresult status, void* userData); 1456 1457 alias CUoccupancyB2DSize = c_ulong function (int blockSize); 1458 1459 enum CU_MEMHOSTALLOC_PORTABLE = 0x01; 1460 1461 enum CU_MEMHOSTALLOC_DEVICEMAP = 0x02; 1462 1463 enum CU_MEMHOSTALLOC_WRITECOMBINED = 0x04; 1464 1465 enum CU_MEMHOSTREGISTER_PORTABLE = 0x01; 1466 1467 enum CU_MEMHOSTREGISTER_DEVICEMAP = 0x02; 1468 1469 enum CU_MEMHOSTREGISTER_IOMEMORY = 0x04; 1470 1471 struct CUDA_MEMCPY2D_st 1472 { 1473 size_t srcXInBytes; /**< Source X in bytes */ 1474 size_t srcY; /**< Source Y */ 1475 1476 CUmemorytype srcMemoryType; /**< Source memory type (host, device, array) */ 1477 const(void)* srcHost; /**< Source host pointer */ 1478 CUdeviceptr srcDevice; /**< Source device pointer */ 1479 CUarray srcArray; /**< Source array reference */ 1480 size_t srcPitch; /**< Source pitch (ignored when src is array) */ 1481 1482 size_t dstXInBytes; /**< Destination X in bytes */ 1483 size_t dstY; /**< Destination Y */ 1484 1485 CUmemorytype dstMemoryType; /**< Destination memory type (host, device, array) */ 1486 void* dstHost; /**< Destination host pointer */ 1487 CUdeviceptr dstDevice; /**< Destination device pointer */ 1488 CUarray dstArray; /**< Destination array reference */ 1489 size_t dstPitch; /**< Destination pitch (ignored when dst is array) */ 1490 1491 size_t WidthInBytes; /**< Width of 2D memory copy in bytes */ 1492 size_t Height; /**< Height of 2D memory copy */ 1493 } 1494 1495 alias CUDA_MEMCPY2D = CUDA_MEMCPY2D_st; 1496 1497 /** 1498 * 3D memory copy parameters 1499 */ 1500 struct CUDA_MEMCPY3D_st 1501 { 1502 size_t srcXInBytes; /**< Source X in bytes */ 1503 size_t srcY; /**< Source Y */ 1504 size_t srcZ; /**< Source Z */ 1505 size_t srcLOD; /**< Source LOD */ 1506 CUmemorytype srcMemoryType; /**< Source memory type (host, device, array) */ 1507 const(void)* srcHost; /**< Source host pointer */ 1508 CUdeviceptr srcDevice; /**< Source device pointer */ 1509 CUarray srcArray; /**< Source array reference */ 1510 void* reserved0; /**< Must be NULL */ 1511 size_t srcPitch; /**< Source pitch (ignored when src is array) */ 1512 size_t srcHeight; /**< Source height (ignored when src is array; may be 0 if Depth==1) */ 1513 1514 size_t dstXInBytes; /**< Destination X in bytes */ 1515 size_t dstY; /**< Destination Y */ 1516 size_t dstZ; /**< Destination Z */ 1517 size_t dstLOD; /**< Destination LOD */ 1518 CUmemorytype dstMemoryType; /**< Destination memory type (host, device, array) */ 1519 void* dstHost; /**< Destination host pointer */ 1520 CUdeviceptr dstDevice; /**< Destination device pointer */ 1521 CUarray dstArray; /**< Destination array reference */ 1522 void* reserved1; /**< Must be NULL */ 1523 size_t dstPitch; /**< Destination pitch (ignored when dst is array) */ 1524 size_t dstHeight; /**< Destination height (ignored when dst is array; may be 0 if Depth==1) */ 1525 1526 size_t WidthInBytes; /**< Width of 3D memory copy in bytes */ 1527 size_t Height; /**< Height of 3D memory copy */ 1528 size_t Depth; /**< Depth of 3D memory copy */ 1529 } 1530 1531 alias CUDA_MEMCPY3D = CUDA_MEMCPY3D_st; 1532 1533 /** 1534 * 3D memory cross-context copy parameters 1535 */ 1536 struct CUDA_MEMCPY3D_PEER_st 1537 { 1538 size_t srcXInBytes; /**< Source X in bytes */ 1539 size_t srcY; /**< Source Y */ 1540 size_t srcZ; /**< Source Z */ 1541 size_t srcLOD; /**< Source LOD */ 1542 CUmemorytype srcMemoryType; /**< Source memory type (host, device, array) */ 1543 const(void)* srcHost; /**< Source host pointer */ 1544 CUdeviceptr srcDevice; /**< Source device pointer */ 1545 CUarray srcArray; /**< Source array reference */ 1546 CUcontext srcContext; /**< Source context (ignored with srcMemoryType is ::CU_MEMORYTYPE_ARRAY) */ 1547 size_t srcPitch; /**< Source pitch (ignored when src is array) */ 1548 size_t srcHeight; /**< Source height (ignored when src is array; may be 0 if Depth==1) */ 1549 1550 size_t dstXInBytes; /**< Destination X in bytes */ 1551 size_t dstY; /**< Destination Y */ 1552 size_t dstZ; /**< Destination Z */ 1553 size_t dstLOD; /**< Destination LOD */ 1554 CUmemorytype dstMemoryType; /**< Destination memory type (host, device, array) */ 1555 void* dstHost; /**< Destination host pointer */ 1556 CUdeviceptr dstDevice; /**< Destination device pointer */ 1557 CUarray dstArray; /**< Destination array reference */ 1558 CUcontext dstContext; /**< Destination context (ignored with dstMemoryType is ::CU_MEMORYTYPE_ARRAY) */ 1559 size_t dstPitch; /**< Destination pitch (ignored when dst is array) */ 1560 size_t dstHeight; /**< Destination height (ignored when dst is array; may be 0 if Depth==1) */ 1561 1562 size_t WidthInBytes; /**< Width of 3D memory copy in bytes */ 1563 size_t Height; /**< Height of 3D memory copy */ 1564 size_t Depth; /**< Depth of 3D memory copy */ 1565 } 1566 1567 alias CUDA_MEMCPY3D_PEER = CUDA_MEMCPY3D_PEER_st; 1568 1569 /** 1570 * Array descriptor 1571 */ 1572 struct CUDA_ARRAY_DESCRIPTOR_st 1573 { 1574 size_t Width; /**< Width of array */ 1575 size_t Height; /**< Height of array */ 1576 1577 CUarray_format Format; /**< Array format */ 1578 uint NumChannels; /**< Channels per array element */ 1579 } 1580 1581 alias CUDA_ARRAY_DESCRIPTOR = CUDA_ARRAY_DESCRIPTOR_st; 1582 1583 /** 1584 * 3D array descriptor 1585 */ 1586 struct CUDA_ARRAY3D_DESCRIPTOR_st 1587 { 1588 size_t Width; /**< Width of 3D array */ 1589 size_t Height; /**< Height of 3D array */ 1590 size_t Depth; /**< Depth of 3D array */ 1591 1592 CUarray_format Format; /**< Array format */ 1593 uint NumChannels; /**< Channels per array element */ 1594 uint Flags; /**< Flags */ 1595 } 1596 1597 alias CUDA_ARRAY3D_DESCRIPTOR = CUDA_ARRAY3D_DESCRIPTOR_st; 1598 1599 /* __CUDA_API_VERSION >= 3020 */ 1600 1601 /** 1602 * CUDA Resource descriptor 1603 */ 1604 struct CUDA_RESOURCE_DESC_st 1605 { 1606 CUresourcetype resType; /**< Resource type */ 1607 1608 /**< CUDA array */ 1609 1610 /**< CUDA mipmapped array */ 1611 1612 /**< Device pointer */ 1613 /**< Array format */ 1614 /**< Channels per array element */ 1615 /**< Size in bytes */ 1616 1617 /**< Device pointer */ 1618 /**< Array format */ 1619 /**< Channels per array element */ 1620 /**< Width of the array in elements */ 1621 /**< Height of the array in elements */ 1622 /**< Pitch between two rows in bytes */ 1623 union _Anonymous_0 1624 { 1625 struct _Anonymous_1 1626 { 1627 CUarray hArray; 1628 } 1629 1630 _Anonymous_1 array; 1631 1632 struct _Anonymous_2 1633 { 1634 CUmipmappedArray hMipmappedArray; 1635 } 1636 1637 _Anonymous_2 mipmap; 1638 1639 struct _Anonymous_3 1640 { 1641 CUdeviceptr devPtr; 1642 CUarray_format format; 1643 uint numChannels; 1644 size_t sizeInBytes; 1645 } 1646 1647 _Anonymous_3 linear; 1648 1649 struct _Anonymous_4 1650 { 1651 CUdeviceptr devPtr; 1652 CUarray_format format; 1653 uint numChannels; 1654 size_t width; 1655 size_t height; 1656 size_t pitchInBytes; 1657 } 1658 1659 _Anonymous_4 pitch2D; 1660 1661 struct _Anonymous_5 1662 { 1663 int[32] reserved; 1664 } 1665 1666 _Anonymous_5 reserved; 1667 } 1668 1669 _Anonymous_0 res; 1670 1671 uint flags; /**< Flags (must be zero) */ 1672 } 1673 1674 alias CUDA_RESOURCE_DESC = CUDA_RESOURCE_DESC_st; 1675 1676 /** 1677 * Texture descriptor 1678 */ 1679 struct CUDA_TEXTURE_DESC_st 1680 { 1681 CUaddress_mode[3] addressMode; /**< Address modes */ 1682 CUfilter_mode filterMode; /**< Filter mode */ 1683 uint flags; /**< Flags */ 1684 uint maxAnisotropy; /**< Maximum anisotropy ratio */ 1685 CUfilter_mode mipmapFilterMode; /**< Mipmap filter mode */ 1686 float mipmapLevelBias; /**< Mipmap level bias */ 1687 float minMipmapLevelClamp; /**< Mipmap minimum level clamp */ 1688 float maxMipmapLevelClamp; /**< Mipmap maximum level clamp */ 1689 int[16] reserved; 1690 } 1691 1692 alias CUDA_TEXTURE_DESC = CUDA_TEXTURE_DESC_st; 1693 1694 /** 1695 * Resource view format 1696 */ 1697 enum CUresourceViewFormat_enum 1698 { 1699 CU_RES_VIEW_FORMAT_NONE = 0, /**< No resource view format (use underlying resource format) */ 1700 CU_RES_VIEW_FORMAT_UINT_1X8 = 1, /**< 1 channel unsigned 8-bit integers */ 1701 CU_RES_VIEW_FORMAT_UINT_2X8 = 2, /**< 2 channel unsigned 8-bit integers */ 1702 CU_RES_VIEW_FORMAT_UINT_4X8 = 3, /**< 4 channel unsigned 8-bit integers */ 1703 CU_RES_VIEW_FORMAT_SINT_1X8 = 4, /**< 1 channel signed 8-bit integers */ 1704 CU_RES_VIEW_FORMAT_SINT_2X8 = 5, /**< 2 channel signed 8-bit integers */ 1705 CU_RES_VIEW_FORMAT_SINT_4X8 = 6, /**< 4 channel signed 8-bit integers */ 1706 CU_RES_VIEW_FORMAT_UINT_1X16 = 7, /**< 1 channel unsigned 16-bit integers */ 1707 CU_RES_VIEW_FORMAT_UINT_2X16 = 8, /**< 2 channel unsigned 16-bit integers */ 1708 CU_RES_VIEW_FORMAT_UINT_4X16 = 9, /**< 4 channel unsigned 16-bit integers */ 1709 CU_RES_VIEW_FORMAT_SINT_1X16 = 10, /**< 1 channel signed 16-bit integers */ 1710 CU_RES_VIEW_FORMAT_SINT_2X16 = 11, /**< 2 channel signed 16-bit integers */ 1711 CU_RES_VIEW_FORMAT_SINT_4X16 = 12, /**< 4 channel signed 16-bit integers */ 1712 CU_RES_VIEW_FORMAT_UINT_1X32 = 13, /**< 1 channel unsigned 32-bit integers */ 1713 CU_RES_VIEW_FORMAT_UINT_2X32 = 14, /**< 2 channel unsigned 32-bit integers */ 1714 CU_RES_VIEW_FORMAT_UINT_4X32 = 15, /**< 4 channel unsigned 32-bit integers */ 1715 CU_RES_VIEW_FORMAT_SINT_1X32 = 16, /**< 1 channel signed 32-bit integers */ 1716 CU_RES_VIEW_FORMAT_SINT_2X32 = 17, /**< 2 channel signed 32-bit integers */ 1717 CU_RES_VIEW_FORMAT_SINT_4X32 = 18, /**< 4 channel signed 32-bit integers */ 1718 CU_RES_VIEW_FORMAT_FLOAT_1X16 = 19, /**< 1 channel 16-bit floating point */ 1719 CU_RES_VIEW_FORMAT_FLOAT_2X16 = 20, /**< 2 channel 16-bit floating point */ 1720 CU_RES_VIEW_FORMAT_FLOAT_4X16 = 21, /**< 4 channel 16-bit floating point */ 1721 CU_RES_VIEW_FORMAT_FLOAT_1X32 = 22, /**< 1 channel 32-bit floating point */ 1722 CU_RES_VIEW_FORMAT_FLOAT_2X32 = 23, /**< 2 channel 32-bit floating point */ 1723 CU_RES_VIEW_FORMAT_FLOAT_4X32 = 24, /**< 4 channel 32-bit floating point */ 1724 CU_RES_VIEW_FORMAT_UNSIGNED_BC1 = 25, /**< Block compressed 1 */ 1725 CU_RES_VIEW_FORMAT_UNSIGNED_BC2 = 26, /**< Block compressed 2 */ 1726 CU_RES_VIEW_FORMAT_UNSIGNED_BC3 = 27, /**< Block compressed 3 */ 1727 CU_RES_VIEW_FORMAT_UNSIGNED_BC4 = 28, /**< Block compressed 4 unsigned */ 1728 CU_RES_VIEW_FORMAT_SIGNED_BC4 = 29, /**< Block compressed 4 signed */ 1729 CU_RES_VIEW_FORMAT_UNSIGNED_BC5 = 30, /**< Block compressed 5 unsigned */ 1730 CU_RES_VIEW_FORMAT_SIGNED_BC5 = 31, /**< Block compressed 5 signed */ 1731 CU_RES_VIEW_FORMAT_UNSIGNED_BC6H = 32, /**< Block compressed 6 unsigned half-float */ 1732 CU_RES_VIEW_FORMAT_SIGNED_BC6H = 33, /**< Block compressed 6 signed half-float */ 1733 CU_RES_VIEW_FORMAT_UNSIGNED_BC7 = 34 /**< Block compressed 7 */ 1734 } 1735 1736 alias CUresourceViewFormat = CUresourceViewFormat_enum; 1737 1738 /** 1739 * Resource view descriptor 1740 */ 1741 struct CUDA_RESOURCE_VIEW_DESC_st 1742 { 1743 CUresourceViewFormat format; /**< Resource view format */ 1744 size_t width; /**< Width of the resource view */ 1745 size_t height; /**< Height of the resource view */ 1746 size_t depth; /**< Depth of the resource view */ 1747 uint firstMipmapLevel; /**< First defined mipmap level */ 1748 uint lastMipmapLevel; /**< Last defined mipmap level */ 1749 uint firstLayer; /**< First layer index */ 1750 uint lastLayer; /**< Last layer index */ 1751 uint[16] reserved; 1752 } 1753 1754 alias CUDA_RESOURCE_VIEW_DESC = CUDA_RESOURCE_VIEW_DESC_st; 1755 1756 /** 1757 * GPU Direct v3 tokens 1758 */ 1759 struct CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st 1760 { 1761 ulong p2pToken; 1762 uint vaSpaceToken; 1763 } 1764 1765 alias CUDA_POINTER_ATTRIBUTE_P2P_TOKENS = CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st; 1766 1767 /* __CUDA_API_VERSION >= 5000 */ 1768 1769 /** 1770 * If set, the CUDA array is a collection of layers, where each layer is either a 1D 1771 * or a 2D array and the Depth member of CUDA_ARRAY3D_DESCRIPTOR specifies the number 1772 * of layers, not the depth of a 3D array. 1773 */ 1774 enum CUDA_ARRAY3D_LAYERED = 0x01; 1775 1776 /** 1777 * Deprecated, use CUDA_ARRAY3D_LAYERED 1778 */ 1779 enum CUDA_ARRAY3D_2DARRAY = 0x01; 1780 1781 /** 1782 * This flag must be set in order to bind a surface reference 1783 * to the CUDA array 1784 */ 1785 enum CUDA_ARRAY3D_SURFACE_LDST = 0x02; 1786 1787 /** 1788 * If set, the CUDA array is a collection of six 2D arrays, representing faces of a cube. The 1789 * width of such a CUDA array must be equal to its height, and Depth must be six. 1790 * If ::CUDA_ARRAY3D_LAYERED flag is also set, then the CUDA array is a collection of cubemaps 1791 * and Depth must be a multiple of six. 1792 */ 1793 enum CUDA_ARRAY3D_CUBEMAP = 0x04; 1794 1795 /** 1796 * This flag must be set in order to perform texture gather operations 1797 * on a CUDA array. 1798 */ 1799 enum CUDA_ARRAY3D_TEXTURE_GATHER = 0x08; 1800 1801 /** 1802 * This flag if set indicates that the CUDA 1803 * array is a DEPTH_TEXTURE. 1804 */ 1805 enum CUDA_ARRAY3D_DEPTH_TEXTURE = 0x10; 1806 1807 /** 1808 * Override the texref format with a format inferred from the array. 1809 * Flag for ::cuTexRefSetArray() 1810 */ 1811 enum CU_TRSA_OVERRIDE_FORMAT = 0x01; 1812 1813 /** 1814 * Read the texture as integers rather than promoting the values to floats 1815 * in the range [0,1]. 1816 * Flag for ::cuTexRefSetFlags() 1817 */ 1818 enum CU_TRSF_READ_AS_INTEGER = 0x01; 1819 1820 /** 1821 * Use normalized texture coordinates in the range [0,1) instead of [0,dim). 1822 * Flag for ::cuTexRefSetFlags() 1823 */ 1824 enum CU_TRSF_NORMALIZED_COORDINATES = 0x02; 1825 1826 /** 1827 * Perform sRGB->linear conversion during texture read. 1828 * Flag for ::cuTexRefSetFlags() 1829 */ 1830 enum CU_TRSF_SRGB = 0x10; 1831 1832 /** 1833 * End of array terminator for the \p extra parameter to 1834 * ::cuLaunchKernel 1835 */ 1836 enum CU_LAUNCH_PARAM_END = cast(void*) 0x00; 1837 1838 /** 1839 * Indicator that the next value in the \p extra parameter to 1840 * ::cuLaunchKernel will be a pointer to a buffer containing all kernel 1841 * parameters used for launching kernel \p f. This buffer needs to 1842 * honor all alignment/padding requirements of the individual parameters. 1843 * If ::CU_LAUNCH_PARAM_BUFFER_SIZE is not also specified in the 1844 * \p extra array, then ::CU_LAUNCH_PARAM_BUFFER_POINTER will have no 1845 * effect. 1846 */ 1847 enum CU_LAUNCH_PARAM_BUFFER_POINTER = cast(void*) 0x01; 1848 1849 /** 1850 * Indicator that the next value in the \p extra parameter to 1851 * ::cuLaunchKernel will be a pointer to a size_t which contains the 1852 * size of the buffer specified with ::CU_LAUNCH_PARAM_BUFFER_POINTER. 1853 * It is required that ::CU_LAUNCH_PARAM_BUFFER_POINTER also be specified 1854 * in the \p extra array if the value associated with 1855 * ::CU_LAUNCH_PARAM_BUFFER_SIZE is not zero. 1856 */ 1857 enum CU_LAUNCH_PARAM_BUFFER_SIZE = cast(void*) 0x02; 1858 1859 /** 1860 * For texture references loaded into the module, use default texunit from 1861 * texture reference. 1862 */ 1863 enum CU_PARAM_TR_DEFAULT = -1; 1864 1865 CUresult cuGetErrorString (CUresult error, const(char*)* pStr); 1866 1867 CUresult cuGetErrorName (CUresult error, const(char*)* pStr); 1868 1869 CUresult cuInit (uint Flags); 1870 1871 CUresult cuDriverGetVersion (int* driverVersion); 1872 1873 CUresult cuDeviceGet (CUdevice* device, int ordinal); 1874 1875 CUresult cuDeviceGetCount (int* count); 1876 1877 CUresult cuDeviceGetName (char* name, int len, CUdevice dev); 1878 1879 CUresult cuDeviceTotalMem_v2 (size_t* bytes, CUdevice dev); 1880 1881 CUresult cuDeviceGetAttribute (int* pi, CUdevice_attribute attrib, CUdevice dev); 1882 1883 CUresult cuDeviceGetProperties (CUdevprop* prop, CUdevice dev); 1884 1885 CUresult cuDeviceComputeCapability (int* major, int* minor, CUdevice dev); 1886 1887 CUresult cuDevicePrimaryCtxRetain (CUcontext* pctx, CUdevice dev); 1888 1889 CUresult cuDevicePrimaryCtxRelease (CUdevice dev); 1890 1891 CUresult cuDevicePrimaryCtxSetFlags (CUdevice dev, uint flags); 1892 1893 CUresult cuDevicePrimaryCtxGetState (CUdevice dev, uint* flags, int* active); 1894 1895 CUresult cuDevicePrimaryCtxReset (CUdevice dev); 1896 1897 CUresult cuCtxCreate_v2 (CUcontext* pctx, uint flags, CUdevice dev); 1898 1899 CUresult cuCtxDestroy_v2 (CUcontext ctx); 1900 1901 CUresult cuCtxPushCurrent_v2 (CUcontext ctx); 1902 1903 CUresult cuCtxPopCurrent_v2 (CUcontext* pctx); 1904 1905 CUresult cuCtxSetCurrent (CUcontext ctx); 1906 1907 CUresult cuCtxGetCurrent (CUcontext* pctx); 1908 1909 CUresult cuCtxGetDevice (CUdevice* device); 1910 1911 CUresult cuCtxGetFlags (uint* flags); 1912 1913 1914 CUresult cuCtxSynchronize (); 1915 1916 CUresult cuCtxSetLimit (CUlimit limit, size_t value); 1917 1918 1919 CUresult cuCtxGetLimit (size_t* pvalue, CUlimit limit); 1920 1921 CUresult cuCtxGetCacheConfig (CUfunc_cache* pconfig); 1922 1923 CUresult cuCtxSetCacheConfig (CUfunc_cache config); 1924 1925 /** 1926 * \brief Returns the current shared memory configuration for the current context. 1927 * 1928 * This function will return in \p pConfig the current size of shared memory banks 1929 * in the current context. On devices with configurable shared memory banks, 1930 * ::cuCtxSetSharedMemConfig can be used to change this setting, so that all 1931 * subsequent kernel launches will by default use the new bank size. When 1932 * ::cuCtxGetSharedMemConfig is called on devices without configurable shared 1933 * memory, it will return the fixed bank size of the hardware. 1934 * 1935 * The returned bank configurations can be either: 1936 * - ::CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE: shared memory bank width is 1937 * four bytes. 1938 * - ::CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE: shared memory bank width will 1939 * eight bytes. 1940 * 1941 * \param pConfig - returned shared memory configuration 1942 * \return 1943 * ::CUDA_SUCCESS, 1944 * ::CUDA_ERROR_DEINITIALIZED, 1945 * ::CUDA_ERROR_NOT_INITIALIZED, 1946 * ::CUDA_ERROR_INVALID_CONTEXT, 1947 * ::CUDA_ERROR_INVALID_VALUE 1948 * \notefnerr 1949 * 1950 * \sa ::cuCtxCreate, 1951 * ::cuCtxDestroy, 1952 * ::cuCtxGetApiVersion, 1953 * ::cuCtxGetCacheConfig, 1954 * ::cuCtxGetDevice, 1955 * ::cuCtxGetFlags, 1956 * ::cuCtxGetLimit, 1957 * ::cuCtxPopCurrent, 1958 * ::cuCtxPushCurrent, 1959 * ::cuCtxSetLimit, 1960 * ::cuCtxSynchronize, 1961 * ::cuCtxGetSharedMemConfig, 1962 * ::cuFuncSetCacheConfig, 1963 */ 1964 CUresult cuCtxGetSharedMemConfig (CUsharedconfig* pConfig); 1965 1966 CUresult cuCtxSetSharedMemConfig (CUsharedconfig config); 1967 1968 /** 1969 * \brief Gets the context's API version. 1970 * 1971 * Returns a version number in \p version corresponding to the capabilities of 1972 * the context (e.g. 3010 or 3020), which library developers can use to direct 1973 * callers to a specific API version. If \p ctx is NULL, returns the API version 1974 * used to create the currently bound context. 1975 * 1976 * Note that new API versions are only introduced when context capabilities are 1977 * changed that break binary compatibility, so the API version and driver version 1978 * may be different. For example, it is valid for the API version to be 3020 while 1979 * the driver version is 4020. 1980 * 1981 * \param ctx - Context to check 1982 * \param version - Pointer to version 1983 * 1984 * \return 1985 * ::CUDA_SUCCESS, 1986 * ::CUDA_ERROR_DEINITIALIZED, 1987 * ::CUDA_ERROR_NOT_INITIALIZED, 1988 * ::CUDA_ERROR_INVALID_CONTEXT, 1989 * ::CUDA_ERROR_UNKNOWN 1990 * \notefnerr 1991 * 1992 * \sa ::cuCtxCreate, 1993 * ::cuCtxDestroy, 1994 * ::cuCtxGetDevice, 1995 * ::cuCtxGetFlags, 1996 * ::cuCtxGetLimit, 1997 * ::cuCtxPopCurrent, 1998 * ::cuCtxPushCurrent, 1999 * ::cuCtxSetCacheConfig, 2000 * ::cuCtxSetLimit, 2001 * ::cuCtxSynchronize 2002 */ 2003 CUresult cuCtxGetApiVersion (CUcontext ctx, uint* version_); 2004 2005 2006 CUresult cuCtxGetStreamPriorityRange (int* leastPriority, int* greatestPriority); 2007 2008 2009 CUresult cuCtxAttach (CUcontext* pctx, uint flags); 2010 2011 CUresult cuCtxDetach (CUcontext ctx); 2012 2013 CUresult cuModuleLoad (CUmodule* module_, const(char)* fname); 2014 2015 CUresult cuModuleLoadData (CUmodule* module_, const(void)* image); 2016 2017 CUresult cuModuleLoadDataEx (CUmodule* module_, const(void)* image, uint numOptions, CUjit_option* options, void** optionValues); 2018 2019 CUresult cuModuleLoadFatBinary (CUmodule* module_, const(void)* fatCubin); 2020 2021 CUresult cuModuleUnload (CUmodule hmod); 2022 2023 CUresult cuModuleGetFunction (CUfunction* hfunc, CUmodule hmod, const(char)* name); 2024 2025 CUresult cuModuleGetGlobal_v2 (CUdeviceptr* dptr, size_t* bytes, CUmodule hmod, const(char)* name); 2026 2027 CUresult cuModuleGetTexRef (CUtexref* pTexRef, CUmodule hmod, const(char)* name); 2028 2029 CUresult cuModuleGetSurfRef (CUsurfref* pSurfRef, CUmodule hmod, const(char)* name); 2030 2031 CUresult cuLinkCreate_v2 ( 2032 uint numOptions, 2033 CUjit_option* options, 2034 void** optionValues, 2035 CUlinkState* stateOut); 2036 2037 2038 CUresult cuLinkAddData_v2 ( 2039 CUlinkState state, 2040 CUjitInputType type, 2041 void* data, 2042 size_t size, 2043 const(char)* name, 2044 uint numOptions, 2045 CUjit_option* options, 2046 void** optionValues); 2047 2048 CUresult cuLinkAddFile_v2 ( 2049 CUlinkState state, 2050 CUjitInputType type, 2051 const(char)* path, 2052 uint numOptions, 2053 CUjit_option* options, 2054 void** optionValues); 2055 2056 CUresult cuLinkComplete (CUlinkState state, void** cubinOut, size_t* sizeOut); 2057 2058 CUresult cuLinkDestroy (CUlinkState state); 2059 2060 CUresult cuMemGetInfo_v2 (size_t* free, size_t* total); 2061 2062 CUresult cuMemAlloc_v2 (CUdeviceptr* dptr, size_t bytesize); 2063 2064 CUresult cuMemAllocPitch_v2 (CUdeviceptr* dptr, size_t* pPitch, size_t WidthInBytes, size_t Height, uint ElementSizeBytes); 2065 2066 CUresult cuMemFree_v2 (CUdeviceptr dptr); 2067 2068 CUresult cuMemGetAddressRange_v2 (CUdeviceptr* pbase, size_t* psize, CUdeviceptr dptr); 2069 2070 CUresult cuMemAllocHost_v2 (void** pp, size_t bytesize); 2071 2072 CUresult cuMemFreeHost (void* p); 2073 2074 CUresult cuMemHostAlloc (void** pp, size_t bytesize, uint Flags); 2075 2076 CUresult cuMemHostGetDevicePointer_v2 (CUdeviceptr* pdptr, void* p, uint Flags); 2077 2078 CUresult cuMemHostGetFlags (uint* pFlags, void* p); 2079 2080 CUresult cuMemAllocManaged (CUdeviceptr* dptr, size_t bytesize, uint flags); 2081 2082 CUresult cuDeviceGetByPCIBusId (CUdevice* dev, const(char)* pciBusId); 2083 2084 CUresult cuDeviceGetPCIBusId (char* pciBusId, int len, CUdevice dev); 2085 2086 2087 CUresult cuIpcGetEventHandle (CUipcEventHandle* pHandle, CUevent event); 2088 2089 2090 CUresult cuIpcOpenEventHandle (CUevent* phEvent, CUipcEventHandle handle); 2091 2092 CUresult cuIpcGetMemHandle (CUipcMemHandle* pHandle, CUdeviceptr dptr); 2093 2094 CUresult cuIpcOpenMemHandle (CUdeviceptr* pdptr, CUipcMemHandle handle, uint Flags); 2095 2096 CUresult cuIpcCloseMemHandle (CUdeviceptr dptr); 2097 2098 CUresult cuMemHostRegister_v2 (void* p, size_t bytesize, uint Flags); 2099 2100 CUresult cuMemHostUnregister (void* p); 2101 2102 CUresult cuMemcpy (CUdeviceptr dst, CUdeviceptr src, size_t ByteCount); 2103 2104 CUresult cuMemcpyPeer (CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount); 2105 2106 CUresult cuMemcpyHtoD_v2 (CUdeviceptr dstDevice, const(void)* srcHost, size_t ByteCount); 2107 2108 CUresult cuMemcpyDtoH_v2 (void* dstHost, CUdeviceptr srcDevice, size_t ByteCount); 2109 2110 CUresult cuMemcpyDtoD_v2 (CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount); 2111 2112 CUresult cuMemcpyDtoA_v2 (CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount); 2113 2114 CUresult cuMemcpyAtoD_v2 (CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount); 2115 2116 CUresult cuMemcpyHtoA_v2 (CUarray dstArray, size_t dstOffset, const(void)* srcHost, size_t ByteCount); 2117 2118 CUresult cuMemcpyAtoH_v2 (void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount); 2119 2120 CUresult cuMemcpyAtoA_v2 (CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount); 2121 2122 CUresult cuMemcpy2D_v2 (const(CUDA_MEMCPY2D)* pCopy); 2123 2124 2125 CUresult cuMemcpy2DUnaligned_v2 (const(CUDA_MEMCPY2D)* pCopy); 2126 2127 2128 CUresult cuMemcpy3D_v2 (const(CUDA_MEMCPY3D)* pCopy); 2129 2130 CUresult cuMemcpy3DPeer (const(CUDA_MEMCPY3D_PEER)* pCopy); 2131 2132 CUresult cuMemcpyAsync (CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream); 2133 2134 CUresult cuMemcpyPeerAsync (CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream); 2135 2136 CUresult cuMemcpyHtoDAsync_v2 (CUdeviceptr dstDevice, const(void)* srcHost, size_t ByteCount, CUstream hStream); 2137 2138 CUresult cuMemcpyDtoHAsync_v2 (void* dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); 2139 2140 CUresult cuMemcpyDtoDAsync_v2 (CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); 2141 2142 CUresult cuMemcpyHtoAAsync_v2 (CUarray dstArray, size_t dstOffset, const(void)* srcHost, size_t ByteCount, CUstream hStream); 2143 2144 CUresult cuMemcpyAtoHAsync_v2 (void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream); 2145 2146 CUresult cuMemcpy2DAsync_v2 (const(CUDA_MEMCPY2D)* pCopy, CUstream hStream); 2147 2148 CUresult cuMemcpy3DAsync_v2 (const(CUDA_MEMCPY3D)* pCopy, CUstream hStream); 2149 2150 CUresult cuMemcpy3DPeerAsync (const(CUDA_MEMCPY3D_PEER)* pCopy, CUstream hStream); 2151 2152 CUresult cuMemsetD8_v2 (CUdeviceptr dstDevice, ubyte uc, size_t N); 2153 2154 CUresult cuMemsetD16_v2 (CUdeviceptr dstDevice, ushort us, size_t N); 2155 2156 CUresult cuMemsetD32_v2 (CUdeviceptr dstDevice, uint ui, size_t N); 2157 2158 CUresult cuMemsetD2D8_v2 (CUdeviceptr dstDevice, size_t dstPitch, ubyte uc, size_t Width, size_t Height); 2159 2160 CUresult cuMemsetD2D16_v2 (CUdeviceptr dstDevice, size_t dstPitch, ushort us, size_t Width, size_t Height); 2161 2162 CUresult cuMemsetD2D32_v2 (CUdeviceptr dstDevice, size_t dstPitch, uint ui, size_t Width, size_t Height); 2163 2164 CUresult cuMemsetD8Async (CUdeviceptr dstDevice, ubyte uc, size_t N, CUstream hStream); 2165 2166 CUresult cuMemsetD16Async (CUdeviceptr dstDevice, ushort us, size_t N, CUstream hStream); 2167 2168 CUresult cuMemsetD32Async (CUdeviceptr dstDevice, uint ui, size_t N, CUstream hStream); 2169 2170 CUresult cuMemsetD2D8Async (CUdeviceptr dstDevice, size_t dstPitch, ubyte uc, size_t Width, size_t Height, CUstream hStream); 2171 2172 CUresult cuMemsetD2D16Async (CUdeviceptr dstDevice, size_t dstPitch, ushort us, size_t Width, size_t Height, CUstream hStream); 2173 2174 CUresult cuMemsetD2D32Async (CUdeviceptr dstDevice, size_t dstPitch, uint ui, size_t Width, size_t Height, CUstream hStream); 2175 2176 CUresult cuArrayCreate_v2 (CUarray* pHandle, const(CUDA_ARRAY_DESCRIPTOR)* pAllocateArray); 2177 2178 CUresult cuArrayGetDescriptor_v2 (CUDA_ARRAY_DESCRIPTOR* pArrayDescriptor, CUarray hArray); 2179 2180 CUresult cuArrayDestroy (CUarray hArray); 2181 2182 CUresult cuArray3DCreate_v2 (CUarray* pHandle, const(CUDA_ARRAY3D_DESCRIPTOR)* pAllocateArray); 2183 2184 CUresult cuArray3DGetDescriptor_v2 (CUDA_ARRAY3D_DESCRIPTOR* pArrayDescriptor, CUarray hArray); 2185 2186 CUresult cuMipmappedArrayCreate (CUmipmappedArray* pHandle, const(CUDA_ARRAY3D_DESCRIPTOR)* pMipmappedArrayDesc, uint numMipmapLevels); 2187 2188 CUresult cuMipmappedArrayGetLevel (CUarray* pLevelArray, CUmipmappedArray hMipmappedArray, uint level); 2189 2190 CUresult cuMipmappedArrayDestroy (CUmipmappedArray hMipmappedArray); 2191 2192 CUresult cuPointerGetAttribute (void* data, CUpointer_attribute attribute, CUdeviceptr ptr); 2193 2194 CUresult cuPointerSetAttribute (const(void)* value, CUpointer_attribute attribute, CUdeviceptr ptr); 2195 2196 CUresult cuPointerGetAttributes (uint numAttributes, CUpointer_attribute* attributes, void** data, CUdeviceptr ptr); 2197 2198 CUresult cuStreamCreate (CUstream* phStream, uint Flags); 2199 2200 CUresult cuStreamCreateWithPriority (CUstream* phStream, uint flags, int priority); 2201 2202 CUresult cuStreamGetPriority (CUstream hStream, int* priority); 2203 2204 CUresult cuStreamGetFlags (CUstream hStream, uint* flags); 2205 2206 CUresult cuStreamWaitEvent (CUstream hStream, CUevent hEvent, uint Flags); 2207 2208 CUresult cuStreamAddCallback (CUstream hStream, CUstreamCallback callback, void* userData, uint flags); 2209 2210 CUresult cuStreamAttachMemAsync (CUstream hStream, CUdeviceptr dptr, size_t length, uint flags); 2211 2212 CUresult cuStreamQuery (CUstream hStream); 2213 2214 CUresult cuStreamSynchronize (CUstream hStream); 2215 2216 CUresult cuStreamDestroy_v2 (CUstream hStream); 2217 2218 CUresult cuEventCreate (CUevent* phEvent, uint Flags); 2219 2220 CUresult cuEventRecord (CUevent hEvent, CUstream hStream); 2221 2222 CUresult cuEventQuery (CUevent hEvent); 2223 2224 CUresult cuEventSynchronize (CUevent hEvent); 2225 2226 CUresult cuEventDestroy_v2 (CUevent hEvent); 2227 2228 CUresult cuEventElapsedTime (float* pMilliseconds, CUevent hStart, CUevent hEnd); 2229 2230 CUresult cuFuncGetAttribute (int* pi, CUfunction_attribute attrib, CUfunction hfunc); 2231 2232 CUresult cuFuncSetCacheConfig (CUfunction hfunc, CUfunc_cache config); 2233 2234 CUresult cuFuncSetSharedMemConfig (CUfunction hfunc, CUsharedconfig config); 2235 2236 CUresult cuLaunchKernel ( 2237 CUfunction f, 2238 uint gridDimX, 2239 uint gridDimY, 2240 uint gridDimZ, 2241 uint blockDimX, 2242 uint blockDimY, 2243 uint blockDimZ, 2244 uint sharedMemBytes, 2245 CUstream hStream, 2246 void** kernelParams, 2247 void** extra); 2248 2249 CUresult cuFuncSetBlockShape (CUfunction hfunc, int x, int y, int z); 2250 2251 CUresult cuFuncSetSharedSize (CUfunction hfunc, uint bytes); 2252 2253 CUresult cuParamSetSize (CUfunction hfunc, uint numbytes); 2254 2255 CUresult cuParamSeti (CUfunction hfunc, int offset, uint value); 2256 2257 CUresult cuParamSetf (CUfunction hfunc, int offset, float value); 2258 2259 CUresult cuParamSetv (CUfunction hfunc, int offset, void* ptr, uint numbytes); 2260 2261 CUresult cuLaunch (CUfunction f); 2262 2263 CUresult cuLaunchGrid (CUfunction f, int grid_width, int grid_height); 2264 2265 CUresult cuLaunchGridAsync (CUfunction f, int grid_width, int grid_height, CUstream hStream); 2266 2267 CUresult cuParamSetTexRef (CUfunction hfunc, int texunit, CUtexref hTexRef); 2268 2269 CUresult cuOccupancyMaxActiveBlocksPerMultiprocessor (int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize); 2270 2271 CUresult cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags (int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, uint flags); 2272 2273 CUresult cuOccupancyMaxPotentialBlockSize (int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit); 2274 2275 CUresult cuOccupancyMaxPotentialBlockSizeWithFlags (int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, uint flags); 2276 2277 CUresult cuTexRefSetArray (CUtexref hTexRef, CUarray hArray, uint Flags); 2278 2279 CUresult cuTexRefSetMipmappedArray (CUtexref hTexRef, CUmipmappedArray hMipmappedArray, uint Flags); 2280 2281 CUresult cuTexRefSetAddress_v2 (size_t* ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t bytes); 2282 2283 CUresult cuTexRefSetAddress2D_v3 (CUtexref hTexRef, const(CUDA_ARRAY_DESCRIPTOR)* desc, CUdeviceptr dptr, size_t Pitch); 2284 2285 CUresult cuTexRefSetFormat (CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents); 2286 2287 CUresult cuTexRefSetAddressMode (CUtexref hTexRef, int dim, CUaddress_mode am); 2288 2289 CUresult cuTexRefSetFilterMode (CUtexref hTexRef, CUfilter_mode fm); 2290 2291 CUresult cuTexRefSetMipmapFilterMode (CUtexref hTexRef, CUfilter_mode fm); 2292 2293 CUresult cuTexRefSetMipmapLevelBias (CUtexref hTexRef, float bias); 2294 2295 CUresult cuTexRefSetMipmapLevelClamp (CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp); 2296 2297 CUresult cuTexRefSetMaxAnisotropy (CUtexref hTexRef, uint maxAniso); 2298 2299 CUresult cuTexRefSetFlags (CUtexref hTexRef, uint Flags); 2300 2301 CUresult cuTexRefGetAddress_v2 (CUdeviceptr* pdptr, CUtexref hTexRef); 2302 2303 CUresult cuTexRefGetArray (CUarray* phArray, CUtexref hTexRef); 2304 2305 CUresult cuTexRefGetMipmappedArray (CUmipmappedArray* phMipmappedArray, CUtexref hTexRef); 2306 2307 CUresult cuTexRefGetAddressMode (CUaddress_mode* pam, CUtexref hTexRef, int dim); 2308 2309 CUresult cuTexRefGetFilterMode (CUfilter_mode* pfm, CUtexref hTexRef); 2310 2311 CUresult cuTexRefGetFormat (CUarray_format* pFormat, int* pNumChannels, CUtexref hTexRef); 2312 2313 CUresult cuTexRefGetMipmapFilterMode (CUfilter_mode* pfm, CUtexref hTexRef); 2314 2315 CUresult cuTexRefGetMipmapLevelBias (float* pbias, CUtexref hTexRef); 2316 2317 CUresult cuTexRefGetMipmapLevelClamp (float* pminMipmapLevelClamp, float* pmaxMipmapLevelClamp, CUtexref hTexRef); 2318 2319 CUresult cuTexRefGetMaxAnisotropy (int* pmaxAniso, CUtexref hTexRef); 2320 2321 CUresult cuTexRefGetFlags (uint* pFlags, CUtexref hTexRef); 2322 2323 CUresult cuTexRefCreate (CUtexref* pTexRef); 2324 2325 CUresult cuTexRefDestroy (CUtexref hTexRef); 2326 2327 CUresult cuSurfRefSetArray (CUsurfref hSurfRef, CUarray hArray, uint Flags); 2328 2329 CUresult cuSurfRefGetArray (CUarray* phArray, CUsurfref hSurfRef); 2330 2331 CUresult cuTexObjectCreate (CUtexObject* pTexObject, const(CUDA_RESOURCE_DESC)* pResDesc, const(CUDA_TEXTURE_DESC)* pTexDesc, const(CUDA_RESOURCE_VIEW_DESC)* pResViewDesc); 2332 2333 CUresult cuTexObjectDestroy (CUtexObject texObject); 2334 2335 CUresult cuTexObjectGetResourceDesc (CUDA_RESOURCE_DESC* pResDesc, CUtexObject texObject); 2336 2337 CUresult cuTexObjectGetTextureDesc (CUDA_TEXTURE_DESC* pTexDesc, CUtexObject texObject); 2338 2339 CUresult cuTexObjectGetResourceViewDesc (CUDA_RESOURCE_VIEW_DESC* pResViewDesc, CUtexObject texObject); 2340 2341 CUresult cuSurfObjectCreate (CUsurfObject* pSurfObject, const(CUDA_RESOURCE_DESC)* pResDesc); 2342 2343 CUresult cuSurfObjectDestroy (CUsurfObject surfObject); 2344 2345 CUresult cuSurfObjectGetResourceDesc (CUDA_RESOURCE_DESC* pResDesc, CUsurfObject surfObject); 2346 2347 CUresult cuDeviceCanAccessPeer (int* canAccessPeer, CUdevice dev, CUdevice peerDev); 2348 2349 CUresult cuCtxEnablePeerAccess (CUcontext peerContext, uint Flags); 2350 2351 CUresult cuCtxDisablePeerAccess (CUcontext peerContext); 2352 2353 CUresult cuGraphicsUnregisterResource (CUgraphicsResource resource); 2354 2355 CUresult cuGraphicsSubResourceGetMappedArray (CUarray* pArray, CUgraphicsResource resource, uint arrayIndex, uint mipLevel); 2356 2357 CUresult cuGraphicsResourceGetMappedMipmappedArray (CUmipmappedArray* pMipmappedArray, CUgraphicsResource resource); 2358 2359 CUresult cuGraphicsResourceGetMappedPointer_v2 (CUdeviceptr* pDevPtr, size_t* pSize, CUgraphicsResource resource); 2360 2361 CUresult cuGraphicsResourceSetMapFlags_v2 (CUgraphicsResource resource, uint flags); 2362 2363 2364 CUresult cuGraphicsMapResources (uint count, CUgraphicsResource* resources, CUstream hStream); 2365 2366 CUresult cuGraphicsUnmapResources (uint count, CUgraphicsResource* resources, CUstream hStream); 2367 2368 /** @} */ /* END CUDA_GRAPHICS */ 2369 2370 CUresult cuGetExportTable (const(void*)* ppExportTable, const(CUuuid)* pExportTableId); 2371